Image compression method and device and storage medium
By blocking and clustering the image data, calculating and sorting the norms of pixels, determining the compressed pixel groups, and adopting appropriate compression strategies, the problems of poor image compression accuracy loss and reconstruction effects in the prior art are solved, and more efficient image compression and reconstruction effects are achieved.
Patent Information
- Application Number
- CN202510149321.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-05-13
AI Technical Summary
During the process of grouping and average calculation, the existing image compression technology has high circuit complexity and serious accuracy losses, resulting in poor image reconstruction after compression, and prone to color casting and color mixing that can be seen in the naked eye.
By chunking the image data to be compressed, the pixels in each pixel matrix block are clustered N times, the norms of each pixel are calculated, and the norms are sorted and grouped, the first and second compressed pixel groups are determined, and different compression strategies are used to compress and store the pixel data of each group.
It reduces the loss of data accuracy during image compression, makes the compressed picture closer to the original picture when reconstructed, and improves the clarity and reconstruction effect of the picture.
Smart Images

Figure CN119996685A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image compression method, device and storage medium. Background Art
[0002] In some image storage or transmission scenarios, in order to reduce the amount of image data, it is usually necessary to compress the image.
[0003] In the prior art, when compressing an image, the pixels of the image are usually classified, and then the pixels in each category are averaged, and finally the average of the pixels in one category is used to replace the pixel values in all categories. However, in the process of designing the group average, the technical solution requires a long combinatorial logic circuit, and the number of sequential logic beats required for operation control is large, which not only wastes the circuit board area, but also loses pixel accuracy. For patterns with clear boundaries, the effect of image restoration is not good, and it is easy to produce visible color cast and color mixing, reducing the clarity of the picture.
[0004] Therefore, it is necessary to provide an improved technical solution to overcome the above technical problems existing in the prior art. Summary of the invention
[0005] The purpose of the present application is to provide an image compression method, device and storage medium, which can reduce the loss of data accuracy during image compression and make the compressed image closer to the original image during reconstruction.
[0006] To achieve the above objectives: In a first aspect, an embodiment of the present application provides an image compression method, comprising: The image data to be compressed is processed into blocks to obtain a plurality of pixel matrix blocks; Performing N clustering processes on the pixels in each pixel matrix block respectively, and obtaining a norm corresponding to each pixel in the pixel matrix block during each clustering process; After each clustering process, the norm corresponding to each pixel in the pixel matrix block is sorted and grouped to obtain a first pixel group and a second pixel group, and the norm corresponding to each pixel in the first pixel group is summed; wherein the norm corresponding to each pixel in the first pixel group is smaller than the norm corresponding to each pixel in the second pixel group; The first compressed pixel group and the second compressed pixel group in each pixel matrix block are determined according to each summation result, and the pixel data in the first compressed pixel group and the second compressed pixel group are compressed and stored respectively according to the preset first compression strategy and the second compression strategy.
[0007] In one embodiment, performing clustering processing N times on pixels in each pixel matrix block to obtain a norm corresponding to each pixel in the pixel matrix block during each clustering processing includes: Determine feature pixels; Subtracting the grayscale value corresponding to the sub-pixel of each pixel in the pixel matrix block from the grayscale value corresponding to the sub-pixel of the feature pixel to obtain the grayscale difference value corresponding to the sub-pixel of each pixel; The absolute values of the grayscale differences corresponding to the sub-pixels of each pixel are summed to obtain the norm corresponding to each pixel.
[0008] In one embodiment, determining the characteristic pixel includes: determining the pixel corresponding to the maximum norm obtained when each pixel matrix block is subjected to each clustering process as the characteristic pixel of the pixel matrix block in the next clustering process.
[0009] In one embodiment, the method further includes: when the norm corresponding to each pixel in the pixel matrix block during clustering processing is zero, ending the clustering processing of the pixel matrix block.
[0010] In one implementation, sorting and grouping the norms corresponding to each pixel in the pixel matrix block to obtain the first pixel group and the second pixel group includes: Obtaining the minimum norm and the maximum norm of the pixel matrix block during each clustering process; Eliminate the minimum norm and the maximum norm, and divide the remaining norms into a first norm group and a second norm group; Performing a first comparison and sorting on the first normed array and the second normed array respectively; According to the result of the first comparison and sorting, a second comparison and sorting is performed on all norms in the pixel matrix block to obtain a first pixel group arranged in an orderly manner and a second pixel group arranged in an unordered manner.
[0011] In one embodiment, determining the first compressed pixel group and the second compressed pixel group in each pixel matrix block according to each summation result includes: The first pixel group corresponding to the minimum value in the summation result is determined as the first compressed pixel group in the pixel matrix block, and the second pixel group corresponding to the first pixel group in the sorted group is determined as the second compressed pixel group.
[0012] In one embodiment, the first compression strategy includes: respectively obtaining grayscale mean values of sub-pixels of all pixels in the first compressed pixel group, and quantizing and saving the grayscale mean value of each sub-pixel; The second compression strategy includes: quantizing and saving the sub-pixel grayscale value of each pixel in the second compressed pixel group.
[0013] In one embodiment, the number of pixels M in the pixel matrix block is a multiple of 8, and N is (M-2) / 2.
[0014] In a second aspect, an embodiment of the present application provides an image compression device, including a processor and a memory storing a computer program, and when the processor runs the computer program, the image compression method as described above is implemented.
[0015] In a third aspect, an embodiment of the present application provides a readable storage medium storing a computer program, which, when executed by a processor, implements the image compression method as described above.
[0016] The image compression method, device and storage medium provided by the embodiment of the present application obtain multiple pixel matrix blocks by processing the image data to be compressed in blocks; clustering the pixels in each pixel matrix block N times respectively to obtain the norm corresponding to each pixel in the pixel matrix block during each clustering process; after each clustering process, sorting and grouping the norms corresponding to each pixel in the pixel matrix block to obtain a first pixel group with a smaller norm and a second pixel group with a larger norm, and summing the norms corresponding to each pixel in the first pixel group; determining the first compressed pixel group and the second compressed pixel group in each pixel matrix block according to each summation result, and compressing and storing the pixel data in the first compressed pixel group and the second compressed pixel group according to the preset first compression strategy and the second compression strategy. In this way, the loss of data accuracy during image compression can be reduced, so that the compressed image is closer to the original image when reconstructed. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A flowchart of an image compression method provided in an embodiment of the present application.
[0019] Figure 2 A schematic diagram of the structure of a pixel matrix block provided in an embodiment of the present application.
[0020] Figure 3 A schematic diagram of the clustering process provided in an embodiment of the present application.
[0021] Figure 4 A schematic diagram of the process of sorting and grouping provided in an embodiment of the present application.
[0022] Figure 5 A schematic diagram of the sorting and grouping processing process provided in an embodiment of the present application.
[0023] Figure 6 A schematic diagram of the compressed storage processing process provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0025] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.
[0026] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in this article, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this article, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein can be interpreted as "at the time of..." or "when..." or "in response to determination". Furthermore, as used in this article, the singular forms "one", "one" and "the" are intended to also include plural forms, unless there is an opposite indication in the context. It should be further understood that the terms "comprising", "including" indicate that there are described features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the existence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Thus, “A, B, or C” or “A, B and / or C” means “any of the following: A; B; C; A and B; A and C; B and C; A, B, and C.” An exception to this definition will occur only when a combination of elements, functions, steps, or operations are inherently mutually exclusive in some manner.
[0027] It should be understood that, although the various steps in the flowchart in the embodiment of the present application are displayed in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and it can be performed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and their execution order is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0028] It should be noted that, in this article, step codes such as S101, S102, etc. are used for the purpose of expressing the corresponding content more clearly and concisely, and do not constitute a substantial limitation on the sequence. When implementing the step, those skilled in the art may execute S102 first and then S101, etc., but these should all be within the scope of protection of this application.
[0029] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0030] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0031] Figure 1 The following is a flow chart of the image compression method provided in the embodiment of the present application. Figure 1 As shown, the image compression method provided in the embodiment of the present application includes: Step S110: Divide the image data to be compressed into blocks to obtain a plurality of pixel matrix blocks.
[0032] Specifically, in the present application, before compressing the image data, the image data is processed in blocks, and the image data to be compressed is compressed in parallel in units of pixel matrix blocks, which can effectively improve the compression efficiency of the image. When the image data is processed in blocks, the image data can be divided into a plurality of pixel data blocks of appropriate sizes according to the main frequency and interface speed of the image processing system. Since the resolution of the display screen is usually a multiple of 8, when the image data is processed in blocks, the number of pixels M in the pixel matrix block can also be directly set to a multiple of 8 according to the resolution of the image. For example, Figure 2 As shown, the image data can be divided into x pixel matrix blocks of two rows and four columns (2×4), each pixel matrix block contains 8 pixels, and each pixel includes three sub-pixels of red (R), green (G), and blue (B), as shown in FIG. Figure 2 R11 is the red sub-pixel in the first row and the first column, G11 is the green sub-pixel in the first row and the first column, and B11 is the blue sub-pixel in the first row and the first column.
[0033] Step S120: performing N times of clustering processing on the pixels in each pixel matrix block respectively, and obtaining the norm corresponding to each pixel in the pixel matrix block during each clustering processing.
[0034] Figure 3 The schematic diagram of the clustering process provided in the embodiment of the present application is as follows. Figure 3 As shown, in one embodiment of the present application, step S120 specifically includes: Step S121: Determine feature pixels.
[0035] Specifically, the pixel corresponding to the maximum norm obtained in each clustering process of each pixel matrix block can be determined as the characteristic pixel of the pixel matrix block in the next clustering process, and the position index of the pixel corresponding to the maximum norm (i.e., the characteristic pixel) can be recorded at the same time so as to be called in the next clustering process. When the pixel matrix block is clustered for the first time, the image processing system can set a default value as the characteristic pixel, for example, Figure 2The pixel pix11 in the first row and first column of is designated as the feature pixel of the pixel matrix block during the first clustering process.
[0036] Step S122: Subtract the grayscale value corresponding to the sub-pixel of each pixel in the pixel matrix block from the grayscale value corresponding to the sub-pixel of the feature pixel to obtain the grayscale difference value corresponding to the sub-pixel of each pixel.
[0037] Specifically, Figure 2 As shown, each pixel data is composed of grayscale values of three RGB sub-pixels. The grayscale values of the RGB sub-pixels of each pixel in the pixel matrix block are subtracted from the grayscale values of the RGB sub-pixels of the feature pixel to obtain the grayscale difference corresponding to the RGB sub-pixels of each pixel in the pixel matrix block.
[0038] Step S123: summing the absolute values of the grayscale differences corresponding to the sub-pixels of each pixel to obtain the norm corresponding to each pixel.
[0039] Specifically, in the case of Figure 2 When clustering the pixel matrix block shown in FIG. 1 , the absolute values of the grayscale differences corresponding to the RGB sub-pixels of each pixel calculated can be summed to obtain 8 pixel distance values. Each pixel distance value is the norm corresponding to each pixel in this clustering process. Each group of norms obtained in each clustering process is saved. When clustering is performed N times, N groups of norms can be obtained. When the number of pixels M in the pixel matrix block is set to a multiple of 8, N can be directly set to (M-2) / 2. For example, Figure 2 The pixel matrix block shown in is clustered three times. It can be understood that when calculating the norm, the norm calculated for the pixel set as the feature pixel is 0.
[0040] It should be noted that when the norm corresponding to each pixel in the pixel matrix block is zero during the clustering process, the clustering process of the pixel matrix block is terminated. When performing the clustering process, if the norm calculated for each pixel in the pixel matrix block is zero, it indicates that the grayscale values of all pixels in the pixel matrix block are the same, and the next round of clustering process is not required. When performing compressed storage, the characteristic pixel in the pixel matrix block (i.e., the first pixel in the pixel matrix block) can be directly quantized and saved as the grayscale mean of the sub-pixels of all pixels in the pixel matrix block.
[0041] Step S130: After each clustering process, the norm corresponding to each pixel in the pixel matrix block is sorted and grouped to obtain a first pixel group and a second pixel group, and the norm corresponding to each pixel in the first pixel group is summed; wherein the norm corresponding to each pixel in the first pixel group is smaller than the norm corresponding to each pixel in the second pixel group.
[0042] Figure 4 The following is a flow chart of the sorting and grouping process provided in the embodiment of the present application. Figure 4 As shown, in one embodiment of the present application, step S130 specifically includes: Step S131: Obtain the minimum norm and maximum norm of the pixel matrix block during each clustering process.
[0043] Step S132: Eliminate the minimum norm and the maximum norm, and divide the remaining norms into a first norm group and a second norm group.
[0044] It can be understood that after each clustering process, the minimum norm of the pixel matrix block is zero, and the maximum norm of the pixel matrix block is the norm corresponding to the feature pixel in the next round of clustering process. Before sorting and grouping, the minimum norm and the maximum norm can be eliminated first, and only the remaining norms can be sorted and grouped, which can save the circuit area used for comparison and calculation during sorting and grouping. And by dividing the remaining norms into a first norm array and a second norm array, and comparing and sorting the norms in the first norm array and the second norm array in parallel, not only can the length of the combinational logic circuit be further shortened, but also the timing beats can be saved through parallel processing, and the timing margin can be increased.
[0045] Step S133: performing a first comparison and sorting on the first normed array and the second normed array respectively.
[0046] For example, Figure 5 As shown, in Figure 2 When the pixel blocks divided in the first comparison and sorting are performed, the minimum norm 0 and the maximum norm are eliminated, and 6 norms are left. The remaining 6 norms are divided into the first norm group and the second norm group. Assuming that the three norms of the first norm group are B, C, and D, and the three norms of the second norm group are E, F, and D, the first norm group and the second norm group are compared and sorted in parallel. For example, for B, C, and D of the first norm group, the smaller value Min_1 and the larger value Max_1 of B and C are obtained by pairwise comparison, and the larger value Max_1 is compared with the remaining D. If Max_1≥D, the larger value Max_1 of B and C is the maximum value L1 of the first norm group, and D is Min_2. The smaller value Min_1 of B and C is compared with Min_2 to obtain the minimum value S1 and the middle value M1 of the first norm group. Similarly, the second norm group can also obtain the minimum value S2, the middle value M2, and the maximum value L2 of the second norm group through the above comparison process.
[0047] Step S134: According to the result of the first comparison and sorting, all norms in the pixel matrix block are compared and sorted for the second time to obtain a first pixel group with an orderly arrangement and a second pixel group with an unordered arrangement.
[0048] For example, Figure 5As shown, in the above Figure 2 When the pixel matrix blocks divided in the second comparison and sorting are performed, the minimum value of one of the two norm arrays is first compared with the maximum value of the other group. If S1≥L2 is satisfied, the three smallest numbers S2, M2, and L2 of the remaining six norms can be obtained, and the norms corresponding to the first pixel group are 0, S2, M2, and L2. If S2≥L1 is satisfied, the norms corresponding to the first pixel group are 0, S1, M1, and L1; if S1≥L2 and S2≥L1 are not satisfied, the minimum value of one of the two norm arrays is further compared with the middle value of the other group. If S1≥M2 is satisfied, the norms corresponding to the first pixel group are 0, S2, M2, and S1. If If S2≥M1 is satisfied, the norm corresponding to the first pixel group is 0, S1, M1, S2; if S1≥M2 and S2≥M1 are not satisfied, the minimum value and the middle value in the two groups are further compared. If S1≥S2 and M1≥M2 are satisfied, the norm corresponding to the first pixel group is 0, S2, S1, M2; if S1≥S2 and M2≥M1 are satisfied, the norm corresponding to the first pixel group is 0, S2, S1, M1; if S2≥S1 and M1≥M2 are satisfied, the norm corresponding to the first pixel group is 0, S1, S2, M2; if S2≥S1 and M2≥M1 are satisfied, the norm corresponding to the first pixel group is 0, S1, S2, M1. After processing all the conditional branches that can obtain the minimum three norms, the ordered arrangement of the smaller four norms can be obtained. The pixels corresponding to the ordered smaller four norms are divided into the first pixel group, and the pixels corresponding to the remaining four norms are automatically divided into the second pixel group and saved according to the position index information of the original corresponding pixels.
[0049] Step S140: Determine the first compressed pixel group and the second compressed pixel group in each pixel matrix block according to each summation result, and compress and store the pixel data in the first compressed pixel group and the second compressed pixel group according to the preset first compression strategy and the second compression strategy respectively.
[0050] In one embodiment of the present application, the first pixel group corresponding to the minimum value in the summation result is determined as the first compressed pixel group in the pixel matrix block, and the second pixel group corresponding to the first pixel group in the sorted group is determined as the second compressed pixel group.
[0051] Specifically, after each clustering process and sorting and grouping process, the corresponding norms in the first pixel group obtained in this process are summed. After N clustering processes and N sorting and grouping processes are performed, N groups of summation results can be obtained through the summation process. For example, for the above Figure 2 After the pixel matrix blocks divided in the above are clustered three times and sorted and grouped three times, the following can be obtained by summing up. Figure 6The three groups of summation results Sum_G1, Sum_G2, and Sum_G3 shown in the figure are compared to obtain the minimum value Min_sum among the three groups of summation results, and the position index refer_min of the summation result is saved. The first pixel group corresponding to Min_sum is determined as the first compressed pixel group, and the second pixel group corresponding to the first pixel group in the sorted group is determined as the second compressed pixel group. Assuming that the norm corresponding to each pixel in the first pixel group corresponding to Min_sum is 0, S2, M2, and S1, the second pixel group is the disordered M1, L1, L2, and the pixels corresponding to the maximum norm during this clustering process.
[0052] like Figure 6 As shown, in one embodiment of the present application, the first compression strategy includes: respectively obtaining grayscale averages R_avg, G_avg, and B_avg for the sub-pixels of all pixels in the first compressed pixel group, and quantizing the grayscale averages R_avg, G_avg, and B_avg of each sub-pixel, and saving the quantized values R_equal, G_equal, and B_equal; the second compression strategy includes: respectively quantizing the sub-pixel grayscale values of each pixel in the second compressed pixel group, and saving the quantized values R_quant, G_quant, and B_quant. When performing quantization and saving, the quantization value when compressing and storing the pixel data can be set according to the sensitivity of the human eye to the pixel component.
[0053] In summary, the image compression method provided in the embodiment of the present application obtains a plurality of pixel matrix blocks by performing block processing on the image data to be compressed; obtains the norm corresponding to each pixel in the pixel matrix block during each clustering processing by performing N clustering processing on the pixels in each pixel matrix block; divides the remaining norms after eliminating the maximum norm and the minimum norm into two groups, and sorts the norms to be compared in the two groups in parallel to save the timing beats and the area of the combinational logic circuit, and selects the first pixel group with a smaller norm and arranged from small to large, and the second pixel group with a larger norm and disordered by conditional comparison, and determines the first compressed pixel group with similar pixel grayscale values and the second compressed pixel group with a large difference in pixel grayscale values according to the norm summation result of the first pixel group, performs mean quantization and storage on the first compressed pixel group with similar pixel grayscale values, and directly quantizes and stores the second compressed pixel group with a large difference in pixel grayscale values, so that the loss of data accuracy during image compression can be reduced, and the pixel information before compression is retained to a great extent, so that the compressed image is closer to the original image during reconstruction.
[0054] Based on the same inventive concept as the aforementioned embodiments, an embodiment of the present application further provides an image compression device, which includes a processor and a memory storing a computer program. When the processor runs the computer program, the image compression method described in the aforementioned embodiments is implemented.
[0055] Based on the same inventive concept as the aforementioned embodiments, an embodiment of the present application further provides a readable storage medium, which stores a computer program. When the computer program is executed by a processor, the image compression method described in the aforementioned embodiments is implemented.
[0056] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0057] In this document, the terms "comprises," "comprising," or any other variations thereof, are intended to cover a non-exclusive inclusion of elements other than those listed and may also include additional elements not expressly listed.
[0058] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An image compression method, characterized in that: include: The image data to be compressed is processed into blocks to obtain a plurality of pixel matrix blocks; Performing N clustering processes on the pixels in each pixel matrix block respectively, and obtaining a norm corresponding to each pixel in the pixel matrix block during each clustering process; After each clustering process, the norm corresponding to each pixel in the pixel matrix block is sorted and grouped to obtain a first pixel group and a second pixel group, and the norm corresponding to each pixel in the first pixel group is summed; wherein the norm corresponding to each pixel in the first pixel group is smaller than the norm corresponding to each pixel in the second pixel group; The first compressed pixel group and the second compressed pixel group in each pixel matrix block are determined according to each summation result, and the pixel data in the first compressed pixel group and the second compressed pixel group are compressed and stored respectively according to the preset first compression strategy and the second compression strategy.
2. The image compression method according to claim 1, characterized in that: The performing clustering processing N times on the pixels in each pixel matrix block respectively to obtain the norm corresponding to each pixel in the pixel matrix block during each clustering processing includes: Determine feature pixels; Subtracting the grayscale value corresponding to the sub-pixel of each pixel in the pixel matrix block from the grayscale value corresponding to the sub-pixel of the feature pixel to obtain the grayscale difference value corresponding to the sub-pixel of each pixel; The absolute values of the grayscale differences corresponding to the sub-pixels of each pixel are summed to obtain the norm corresponding to each pixel.
3. The image compression method according to claim 2, characterized in that: The determining of the characteristic pixels comprises: determining the pixel corresponding to the maximum norm obtained when each pixel matrix block is subjected to each clustering process as the characteristic pixel of the pixel matrix block in the next clustering process.
4. The image compression method according to claim 2, characterized in that: Also includes: When the norm corresponding to each pixel in the pixel matrix block during clustering processing is zero, the clustering processing of the pixel matrix block is terminated.
5. The image compression method according to claim 1, characterized in that: The step of sorting and grouping the norm corresponding to each pixel in the pixel matrix block to obtain a first pixel group and a second pixel group includes: Obtaining the minimum norm and the maximum norm of the pixel matrix block during each clustering process; Eliminate the minimum norm and the maximum norm, and divide the remaining norms into a first norm group and a second norm group; Performing a first comparison and sorting on the first normed array and the second normed array respectively; According to the result of the first comparison and sorting, a second comparison and sorting is performed on all norms in the pixel matrix block to obtain a first pixel group arranged in an orderly manner and a second pixel group arranged in an unordered manner.
6. The image compression method according to claim 1, characterized in that: The step of determining the first compressed pixel group and the second compressed pixel group in each pixel matrix block according to each summation result comprises: The first pixel group corresponding to the minimum value in the summation result is determined as the first compressed pixel group in the pixel matrix block, and the second pixel group corresponding to the first pixel group in the sorted group is determined as the second compressed pixel group.
7. The image compression method according to claim 6, characterized in that: The first compression strategy includes: respectively obtaining grayscale mean values of sub-pixels of all pixels in the first compressed pixel group, and quantizing and saving the grayscale mean value of each sub-pixel; The second compression strategy includes: quantizing and saving the sub-pixel grayscale value of each pixel in the second compressed pixel group.
8. The image compression method according to claim 5, characterized in that: When the number of pixels M in the pixel matrix block is a multiple of 8, N is (M-2) / 2.
9. An image compression device, characterized in that: The invention comprises a processor and a memory storing a computer program, and when the processor runs the computer program, the image compression method according to any one of claims 1 to 8 is implemented.
10. A readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the image compression method according to any one of claims 1 to 8 is implemented.