Image processing method, computer device and storage medium

By analyzing the sparseness of Bitmap images and adaptively selecting the compression strategy, the problems of low compression efficiency or image quality loss in the prior art are solved, and efficient image compression and optimized display effects are achieved.

CN120475153APending Publication Date: 2025-08-12BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510583681.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-07
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

In the prior art, the compression method of Bitmap images cannot be dynamically adjusted according to the sparseness of image data, resulting in low compression efficiency or excessive image quality loss.

Method used

By analyzing the sparseness of the image, adaptively select the most suitable compression strategy, including segmented storage compression, differential storage compression, sampling rate compression, quality compression and lossy compression, etc., and dynamically adjust the compression method to optimize the display effect.

Benefits of technology

It achieves the maximum compression ratio and compression efficiency while maintaining the image display effect. It is suitable for different types of Bitmap images and has strong versatility and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120475153A_ABST
    Figure CN120475153A_ABST
Patent Text Reader

Abstract

The invention discloses an image processing method, a computer device and a storage medium, and the method comprises the steps: obtaining a first image, analyzing the sparseness of the first image, and determining the sparseness type of the first image; based on the sparseness type of the first image, executing a corresponding image compression strategy on the first image to obtain a compressed second image; evaluating the display effect of the second image to obtain a first evaluation result; and under the condition that the first evaluation result does not meet the display requirement of the second image, adjusting the image compression strategy to optimize the display effect of the second image. By dynamically adjusting the compression mode, the high efficiency of image compression is ensured, and the maximum compression ratio is realized while the image display effect is kept.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the rapid development of digital image processing technology, bitmap images are increasingly used. However, bitmap images typically occupy a large amount of storage space, placing significant pressure on storage and transmission. Traditional bitmap compression methods often use fixed compression strategies that cannot dynamically adjust to the sparsity of image data, resulting in low compression efficiency or significant image quality loss. Summary of the Invention

[0003] The embodiments of the present application provide an image processing method, a computer device, and a storage medium. By analyzing the sparsity of an image, a compression strategy that is most suitable for the current image data is adaptively selected to ensure the display effect of the compressed image.

[0004] To achieve the above-mentioned object, an embodiment of the present application provides an image processing method, characterized in that the method includes:

[0005] Acquire a first image, analyze the sparsity of the first image, and determine a sparsity type of the first image; wherein the sparsity types include a first sparsity type, a second sparsity type, and a third sparsity type, the first sparsity type having a higher level than the second sparsity type, and the second sparsity type having a higher level than the third sparsity type;

[0006] executing a corresponding image compression strategy on the first image based on the sparsity type of the first image to obtain a compressed second image;

[0007] evaluating a display effect of the second image to obtain a first evaluation result;

[0008] In a case where the first evaluation result does not meet the display requirement of the second image, the image compression strategy is adjusted to optimize the display effect of the second image.

[0009] Preferably, analyzing the sparsity of the first image to determine the sparsity type of the first image includes:

[0010] Determining a first number of first pixels included in the first image, and determining a first ratio of the first number of the first pixels to a second number of all pixels included in the first image; wherein the pixel values of the first pixels are non-zero;

[0011] Based on the first ratio, a sparsity type of the first image is determined.

[0012] Preferably, the performing a corresponding image compression strategy on the first image based on the sparsity type of the first image to obtain a compressed second image includes:

[0013] determining, based on a first ratio of a first number of first pixels included in the first image to a second number of all pixels included in the first image, an image compression strategy of a sparsity type for the first image, wherein the first ratio includes a first parameter range, a second parameter range, and a third parameter range, a value of the first parameter range is higher than that of the second parameter range, and a value of the second parameter range is higher than that of the third parameter range;

[0014] Based on the sparsity type of the first image, one or more image compression strategies are performed on the first image to obtain a compressed second image.

[0015] Preferably, the performing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image further comprises:

[0016] When the first ratio is within a first parameter range, determining that the sparsity type of the first image is a first type of sparsity;

[0017] When the sparsity type of the first image is the first type of sparsity, the first image is compressed by using a segmented storage compression or a differential storage compression method to obtain a compressed second image.

[0018] Preferably, the performing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image further comprises:

[0019] When the first ratio is within a second parameter range, determining that the sparsity type of the first image is a second type of sparsity;

[0020] In a case where the sparsity type of the first image is the second type of sparsity, the first image is compressed using a quality compression method to obtain a compressed second image.

[0021] Preferably, the performing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image further comprises:

[0022] When the first ratio is within a third parameter range, determining that the sparsity type of the first image is a third type of sparsity;

[0023] When the sparsity type of the first image is the third type of sparsity, the first image is compressed using a sampling rate compression method to obtain a compressed second image.

[0024] Preferably, the evaluating the display effect of the second image to obtain a first evaluation result includes:

[0025] Evaluate the resolution, color depth, file size, and compression effect of the second image to obtain a plurality of first sub-evaluation results corresponding to the respective images;

[0026] In the case that one or more of the plurality of first sub-evaluation results do not meet the display requirements of the second image, multiple image compression methods are adopted or the current image compression method is changed to optimize the display effect of the second image.

[0027] An embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-mentioned image processing method.

[0028] An embodiment of the present application further provides a computer-readable storage medium having a computer program / instruction stored thereon, wherein the computer program / instruction, when executed by a processor, implements the steps of the above-mentioned image processing method.

[0029] An embodiment of the present application further provides a computer program product, comprising a computer program / instruction, wherein the computer program / instruction implements the steps of the above-mentioned image processing method when executed by a processor.

[0030] Compared with existing technologies, the advantages of the embodiments of this application are as follows: by analyzing the image sparsity, this application adaptively selects the compression strategy most suitable for the current image data. During the compression process, the image display is evaluated and adjusted to ensure the display quality of the compressed image. This application is applicable to different types of bitmap images and has strong versatility and flexibility. By dynamically adjusting the compression method, this application ensures efficient image compression and achieves the maximum compression ratio while maintaining the image display quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 This is a flowchart of an image processing method according to an embodiment of the present application;

[0032] Figure 2 For the embodiment of this application Figure 1 Flowchart of an embodiment of step S100;

[0033] Figure 3 For the embodiment of this application Figure 1 Flowchart of an embodiment of step S200;

[0034] Figure 4 For the embodiment of this application Figure 1 A flowchart of an embodiment of step S300;

[0035] Figure 5 A schematic diagram of an image processing system according to an embodiment of the present application;

[0036] Figure 6 This is a structural block diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0037] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0038] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but merely as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0039] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0040] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0041] It should also be understood that although the present application has been described with reference to certain specific examples, those skilled in the art will readily be able to implement many other equivalent forms of the present application.

[0042] The above and other aspects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.

[0043] Specific embodiments of the present application will be described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments described are merely examples of the present application and may be implemented in a variety of ways. Familiar and / or repetitive functions and structures are not described in detail to avoid obscuring the present application with unnecessary or redundant details. Therefore, the specific structural and functional details described herein are not intended to be limiting, but rather serve merely as a basis and representative basis for the claims to teach those skilled in the art to variously utilize the present application with substantially any suitable detailed structure.

[0044] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," which may all refer to one or more of the same or different embodiments according to the present application.

[0045] like Figure 1 As shown, an embodiment of the present application provides an image processing method, the method comprising:

[0046] S100: Acquire a first image, analyze the sparsity of the first image, and determine a sparsity type of the first image; wherein the sparsity types include a first sparsity type, a second sparsity type, and a third sparsity type, wherein the first sparsity type has a higher level than the second sparsity type, and the second sparsity type has a higher level than the third sparsity type;

[0047] In this embodiment, a first image is first obtained. The first image may be Bitmap image data corresponding to a photo or an application icon. For example, the first image is Bitmap image data generated by a video monitoring and analysis system. Common formats of Bitmap images include RGB_565 format and ARGB_8888 format. The RGB_565 format can occupy less memory than the ARGB_8888 format. Each pixel of a Bitmap image in the RGB_565 format occupies only 2 bytes instead of 4 bytes. After obtaining the first image, the sparsity of the first image may be analyzed. The sparsity may be the proportion of pixels in the image with non-zero values. Specifically, the first image is scanned row by row or column by column, the number of non-zero-valued pixels in the first image is counted, and the proportion of non-zero-valued pixels in the first image to the total number of pixels is calculated. After analyzing the sparsity of the first image, the sparsity type of the first image can be determined. The sparsity types include first-class sparsity, second-class sparsity, and third-class sparsity. The first-class sparsity has a higher level than the second-class sparsity, and the second-class sparsity has a higher level than the third-class sparsity. Specifically, the sparsity of the first image can be graded based on the sparsity of the first image. The first image with the first-class sparsity can be a high-sparseness image, the first image with the second-class sparsity can be a medium-sparseness image, and the first image with the third-class sparsity can be a low-sparseness image. High-sparseness images usually have rich details and complex texture features. For example, in medical images, high sparsity can be manifested as high-contrast image areas, such as blood vessels, tumors, etc. These areas contain a large number of non-zero pixels, while the background part may be close to zero values. Medium-sparseness images usually have certain details, but are not as complex as high-sparseness images overall. For example, some natural images may exhibit moderate sparsity, where some areas are rich in details while other areas are relatively flat. Low-sparsity images are usually characterized by a single color or simple texture, such as a solid background or a uniformly distributed grayscale image.

[0048] S200, executing a corresponding image compression strategy on the first image based on the sparsity type of the first image to obtain a compressed second image;

[0049] In this embodiment, after determining the sparsity type of the first image, a corresponding image compression strategy may be executed on the first image based on the sparsity type of the first image to obtain a compressed second image. Specifically, for different sparsity types of the first image, one or more image compression strategies may be executed on the first image. The image compression strategy may include a specific method for compressing the first image. For example, the image compression strategy may include the following image compression methods: segmented storage compression, differential storage compression, sampling rate compression, quality compression, lossless compression, and lossy compression. Based on the sparsity type of the first image, one or more compression methods may be selected from the above-mentioned image compression methods to compress the first image. For example, for a high-sparsity image, Run-Length Encoding (RLE) or a similar lossless compression method may be used for compression; for a medium-sparsity image, a lossy compression method may be used for compression; and for a low-sparsity image, a sampling rate compression method may be used for compression.

[0050] S300, evaluating a display effect of the second image to obtain a first evaluation result;

[0051] In this embodiment, after compressing a first image to obtain a compressed second image, the display quality of the second image is evaluated to obtain a first evaluation result, and a determination is made as to whether the first evaluation result meets the display requirements of the second image. Specifically, the display quality of the second image can be evaluated based on its resolution, color depth, file size, and compression effect. For example, a subjective evaluation based on human visual perception can be performed by comparing the first and second images before and after compression, thereby intuitively determining whether the display quality of the compressed second image meets the display requirements.

[0052] S400: When the first evaluation result does not meet the display requirement of the second image, adjust the image compression strategy to optimize the display effect of the second image.

[0053] In this embodiment, the display effect of the second image is evaluated. After obtaining a first evaluation result, if the first evaluation result does not meet the display requirements of the second image, the image compression strategy is adjusted to optimize the display effect of the second image. Specifically, if one or more of the resolution, color depth, file size, and compression effect of the second image does not meet the display quality requirements, the image compression strategy can be changed or an image compression strategy can be added to ensure that the display effect of the second image meets the display requirements. For example, for a highly sparse image, segmented storage compression can be used for compression. If the compression effect is not good, differential storage compression can be used for compression.

[0054] The present application analyzes the sparsity of the first image in the above-mentioned manner to determine the sparsity type of the first image; then, based on the sparsity type of the first image, executes the corresponding image compression strategy on the first image to obtain the compressed second image; and evaluates the display effect of the second image. If the display effect of the second image is not good, the image compression strategy is adjusted to optimize the display effect of the second image. The present application adaptively selects the compression strategy that best suits the current image data by analyzing the sparsity of the image. During the compression process, the display effect of the compressed image is ensured through evaluation and adjustment of the image display. The present application is applicable to different types of Bitmap images and has strong versatility and flexibility. The present application ensures the high efficiency of image compression by dynamically adjusting the compression method, and achieves the maximum compression ratio while maintaining the image display effect.

[0055] In one embodiment of the present application, Figure 2 As shown, parsing the sparsity of the first image to determine the sparsity type of the first image includes:

[0056] S110, determining a first number of first pixels included in the first image, and determining a first ratio of the first number of the first pixels to a second number of all pixels included in the first image; wherein the pixel values of the first pixels are non-zero;

[0057] In this embodiment, the sparsity of the first image is parsed, and in the process of determining the sparsity type of the first image, a first number of first pixels in the first image is first determined, where the pixel values of the first pixels are non-zero, and a first ratio of the first number of the first pixels to a second number of all pixels in the first image is determined, where the first ratio represents the sparsity of the first image. Specifically, the system first determines that the first image is a photograph or an application icon, and then loads the first image as a bitmap image. Thereafter, the system traverses each pixel of the bitmap image, counts the number of non-zero pixels in the bitmap image, and obtains a first ratio based on the number of non-zero pixels in the bitmap image and the total number of pixels in the bitmap image. That is, the number of non-zero pixels in the bitmap image is divided by the total number of pixels in the bitmap image to obtain the sparsity value of the bitmap image. The sparsity value reflects the proportion of non-zero pixels in the bitmap image, that is, the sparsity of the first image. In the process of traversing the entire bitmap image, the bitmap image data can be divided into multiple small blocks, each of which is processed on a different node; each node maintains a local bitmap, and the results are then merged. This approach can effectively utilize multi-core processors and distributed computing resources to improve processing speed and efficiency.

[0058] S120: Determine a sparsity type of the first image based on the first ratio.

[0059] In this embodiment, after obtaining a first ratio representing the sparsity of the first image, the sparsity type of the first image can be determined based on the first ratio. Specifically, the sparsity type of the first image can be determined based on a first ratio of a first number of non-zero pixels to a second number of all pixels in the first image. The sparsity types of the first image include first-class sparsity, second-class sparsity, and third-class sparsity. A first image with first-class sparsity may be a high-sparsity image, a first image with second-class sparsity may be a medium-sparsity image, and a first image with third-class sparsity may be a low-sparsity image. A high-sparsity image refers to an image with a high proportion of non-zero pixels, that is, most pixel values are non-zero. High-sparsity images are also common in the field of compressed sensing because their sparsity enables compression algorithms to efficiently extract key features and reconstruct images. The proportion of non-zero pixels in a medium-sparsity image is between high and low sparsity. Medium-sparsity images are also widely used in compressed sensing because their sparsity allows key features to be extracted through optimization algorithms. Low-sparseness images are images with a low proportion of non-zero pixels, meaning that most pixel values are close to zero. Low-sparseness images typically do not require complex feature extraction in compressed sensing because their low sparsity allows for direct compression to achieve good results.

[0060] In one embodiment of the present application, Figure 3 As shown, the performing of a corresponding image compression strategy on the first image based on the sparsity type of the first image to obtain a compressed second image includes:

[0061] S210: Determine an image compression strategy of a sparsity type for the first image based on a first ratio of a first number of first pixels included in the first image to a second number of all pixels included in the first image, wherein the first ratio includes a first parameter range, a second parameter range, and a third parameter range, a value of the first parameter range is higher than a value of the second parameter range, and a value of the second parameter range is higher than a value of the third parameter range;

[0062] In this embodiment, after obtaining a first ratio of a first number of first pixels contained in a first image to a second number of all pixels contained in the first image, a parameter range for the first ratio can be determined. The parameter range for the first ratio includes a first parameter range, a second parameter range, and a third parameter range. The value of the first parameter range is higher than the value of the second parameter range, and the value of the second parameter range is higher than the third parameter range. The parameter range for the first ratio can represent the sparsity of the first image. For example, the first parameter range can be set to 70%-100%, that is, the proportion of non-zero pixels in the first image is 70%-100%. When the parameter range for the first ratio falls within the first parameter range, the data contained in the first image is edge detection results or high-level features of a neural network, and the first parameter range represents the first image as a high-sparsity image. The second parameter range can be set to 30%-70%, that is, the proportion of non-zero pixels in the first image is 30%-70%. When the parameter range for the first ratio falls within the second parameter range, the first image can be a natural landscape photograph with rich details but relatively uniform overall quality, and the second parameter range represents the first image as a medium-sparsity image. The third parameter range can be set to 10%-30%, that is, the proportion of non-zero pixels in the first image is 0%-30%. When the parameter range of the first proportion is the third parameter range, the data contained in the first image is dense data, and the first image can be a smooth area of a natural image or a solid color background image. The third parameter range characterizes that the first image is a low-sparseness image.

[0063] S220: Execute one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image.

[0064] In this embodiment, after determining a specific parameter range for a first ratio of a first number of first pixels in the first image to a second number of all pixels in the first image, an image compression strategy specific to the sparsity type of the first image can be determined based on the specific parameter range of the first ratio. One or more image compression strategies can be applied to the first image to obtain a compressed second image. Specific methods for compressing the first image may include: segmented storage compression, differential storage compression, sampling rate compression, quality compression, lossless compression, and lossy compression. The image compression strategy can employ one or more of the above-mentioned image compression methods to compress the first image for different specific parameter ranges of the first ratio. For example, if the parameter range of the first ratio is within the first parameter range, indicating that the first image is a high-sparsity image, segmented storage compression or differential storage compression can be employed for compression, or the original data can be maintained unchanged. If the parameter range of the first ratio is within the second parameter range, indicating that the first image is a medium-sparsity image, lossy compression can be employed for compression. If the parameter range of the first ratio is within the third parameter range, indicating that the first image is a low-sparsity image, sampling rate compression can be employed for compression.

[0065] In one embodiment of the present application, performing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image further includes:

[0066] When the first ratio is within a first parameter range, determining that the sparsity type of the first image is a first type of sparsity;

[0067] When the sparsity type of the first image is the first type of sparsity, the first image is compressed by using a segmented storage compression or a differential storage compression method to obtain a compressed second image.

[0068] In this embodiment, a first ratio of a first number of first pixels in a first image to a second number of all pixels contained in the first image is determined, and based on the first ratio, the sparsity type of the first image is determined. When the sparsity type of the first image is a first type of sparsity, the first image is characterized as a high-sparsity image. The first image can be compressed using segmented storage compression or differential storage compression to obtain a compressed second image.

[0069] Segmented storage divides a large bitmap image into multiple small segments, storing only the segments containing valid data. Valid data can be non-zero or significant values. Segmented storage can significantly reduce storage space because most segments in sparse bitmap images may be all zero or contain repeated values. For example, for a large bitmap image, the black background area accounts for about 85% and has a pixel value of 0; the other areas account for about 12%, with pixel values concentrated in the range of 2000-4000; and the bright white special areas account for about 3%, with pixel values exceeding 6000. For this bitmap image, the image can be divided into 64×64 pixel blocks, a total of 256 blocks, each containing 4096 pixel values. The container type is dynamically selected based on the pixel distribution of each block as follows: all-zero block marker (size 0 bytes), continuous value RLE compression (size ~100 bytes), and array storage of non-zero coordinates (size ~2KB).

[0070] Differential storage merges adjacent identical values in a bitmap image to further reduce storage space. Differential storage is suitable for sparse bitmap images containing a large number of consecutive identical values. For example, for a large bitmap image, the black background area accounts for about 85%, with a pixel value of 0; the other area accounts for about 12%, with pixel values concentrated in the range of 2000-4000; the special bright white area accounts for about 3%, with pixel values exceeding 6000; run-length encoding (RLE) is performed on each row of pixels, and consecutive identical values are merged, and those with differences are stored.

[0071] In one embodiment of the present application, performing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image further includes:

[0072] When the first ratio is within a second parameter range, determining that the sparsity type of the first image is a second type of sparsity;

[0073] In a case where the sparsity type of the first image is the second type of sparsity, the first image is compressed using a quality compression method to obtain a compressed second image.

[0074] In this embodiment, a first ratio of a first number of first pixels in a first image to a second number of all pixels contained in the first image is determined, and after determining the sparsity type of the first image based on the first ratio, when the sparsity type of the first image is the second type of sparsity, the first image is characterized as a medium-sparseness image, and the first image can be compressed using quality compression to obtain a compressed second image. Quality compression reduces the file size by changing the bit depth, transparency, etc. of the image while keeping the number of pixels unchanged. Quality compression is suitable for scenarios such as network transmission where file size needs to be reduced without worrying about memory usage. It should be noted that quality compression may result in loss of image quality and is invalid for images in PNG format because PNG is a lossless compression format. For example, the image capture scenario is a 6000×4000 resolution 16-bit TIFF file. The image display requirement is that the web page only needs to display an 800×600 resolution 8-bit picture, and the human eye must not notice any obvious image quality loss. A quality compression method is used to first reduce the image bit depth, then perform color gamut conversion, and finally optimize the image quantization table.

[0075] In one embodiment of the present application, performing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image further includes:

[0076] When the first ratio is within a third parameter range, determining that the sparsity type of the first image is a third type of sparsity;

[0077] When the sparsity type of the first image is the third type of sparsity, the first image is compressed using a sampling rate compression method to obtain a compressed second image.

[0078] In this embodiment, a first ratio of a first number of first pixels in a first image to a second number of all pixels contained in the first image is determined, and based on the first ratio, the sparsity type of the first image is determined. When the sparsity type of the first image is the third type of sparsity, the first image is characterized as a low-sparsity image. The first image can be compressed using a sampling rate compression method to obtain a compressed second image.

[0079] Sampling rate compression can reduce the number of pixels by adjusting the width and height of a bitmap image, thereby reducing memory usage and file size. Sampling rate compression is suitable for scenarios where file size needs to be reduced while maintaining a certain level of image quality. For example, consider a 4K ultra-high-definition video stream (3840×2160@30fps) captured by a traffic camera. Real-time license plate recognition is required. The raw image data captured by the camera is an 8-bit RGB image per frame, occupying 24MB of memory. The actual requirement for the license plate image is that the license plate area must be approximately 200×200 pixels for clear recognition. Using sampling rate compression, the region of interest is first detected and the image is downsampled to 640×360 pixels. The license plate's position is then detected to obtain its coordinates. Local dynamic sampling is performed, and the license plate area is cropped while maintaining its original resolution.

[0080] In one embodiment of the present application, Figure 4 As shown, the evaluating the display effect of the second image to obtain a first evaluation result includes:

[0081] S310, evaluating the resolution, color depth, file size, and compression effect of the second image to obtain a plurality of first sub-evaluation results corresponding to the respective images;

[0082] S320: When one or more of the plurality of first sub-evaluation results do not meet the display requirements of the second image, adopt a plurality of image compression methods or change the current image compression method to optimize the display effect of the second image.

[0083] In this embodiment, after executing a corresponding image compression strategy on a first image to obtain a compressed second image, the display effect of the second image is evaluated. Specifically, the resolution, color depth, file size, and compression effect of the second image are evaluated to obtain multiple corresponding first sub-evaluation results. First, regarding the first sub-evaluation result corresponding to the resolution of the second image, resolution is a key factor in determining image clarity. Higher resolution generally means higher image quality. During the compression process, if the resolution is significantly reduced, image quality is likely to be affected. Second, regarding the first sub-evaluation result corresponding to the color depth of the second image, color depth is an important evaluation metric. Color depth indicates the number of colors per pixel in the image. Higher color depth generally results in better image quality, but also increases file size. During compression, if color depth is reduced, the image's color expression and details may be compromised. Regarding the first sub-evaluation result corresponding to the file size of the second image, changes in file size are an intuitive way to assess image quality. File size does not directly equate to image quality, but generally, a significant reduction in file size often indicates some loss in image quality, especially when using lossy compression formats such as JPEG. The first sub-evaluation result for the compression effect of the second image can be subjectively evaluated by comparing the images before and after compression. This evaluation method relies on human visual perception. By comparing the original and compressed images, one can intuitively determine whether the image quality is acceptable. For example, a reasonable evaluation range can be set for the compressed second image: resolution above 300 dpi; color depth at 24-bit sRGB; image size at 35×45 mm; and file size at 50 KB.

[0084] In the event that one or more of the multiple first sub-evaluation results do not meet the display requirements of the second image, multiple image compression methods are used or the current image compression method is changed to optimize the display effect of the second image. For example, for a large Bitmap image, the black background area accounts for about 85%, with a pixel value of 0; the other areas account for about 12%, with pixel values concentrated in the range of 2000-4000; the bright white special area accounts for about 3%, with a pixel value of more than 6000; first, the segmented storage compression method is used for compression. If it is found that the compression effect is not good, it can be adjusted to the differential storage compression method for compression. For images with high sparsity, if only a part of the image area is needed, the sampling rate compression method can be used for compression.

[0085] The present application also proposes an image processing system, such as Figure 5 Shown, including:

[0086] a dynamic sparsity analysis module, configured to acquire a first image, analyze the sparsity of the first image, and determine a sparsity type of the first image; wherein the sparsity types include a first sparsity type, a second sparsity type, and a third sparsity type, wherein the first sparsity type has a higher level than the second sparsity type, and the second sparsity type has a higher level than the third sparsity type;

[0087] a compression execution module, configured to execute a corresponding image compression strategy on the first image based on the sparsity type of the first image, to obtain a compressed second image;

[0088] a quality evaluation and adjustment module, configured to evaluate a display effect of the second image to obtain a first evaluation result;

[0089] The adaptive compression strategy selection module is used to adjust the image compression strategy to optimize the display effect of the second image when the first evaluation result does not meet the display requirements of the second image.

[0090] The present application also provides a computer device, such as Figure 6 As shown, it includes a processor and a memory, the memory stores an executable program, and the processor executes the steps of the image processing method described in each embodiment of the present application.

[0091] The computer device in the embodiments of the present application may be a terminal or other device other than a terminal. For example, the computer device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. It may also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), an ATM, or an kiosks, etc., and the embodiments of the present disclosure do not specifically limit this.

[0092] The memory may include RAM (Random Access Memory) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0093] The above-mentioned processor can be a general-purpose processor, including a CPU, NP (Network Processor), etc.; it can also be a DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0094] In another embodiment provided in the present application, a computer-readable storage medium is further provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the image processing method described in each embodiment of the present application are implemented.

[0095] In another embodiment provided by the present application, a computer program product is also provided, including a computer program / instruction, which implements the steps of the image processing method described in each embodiment of the present application when executed by a processor.

[0096] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk).

[0097] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.

[0098] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. An image processing method, characterized in that: The method comprises: Acquire a first image, analyze the sparsity of the first image, and determine a sparsity type of the first image; wherein the sparsity types include a first sparsity type, a second sparsity type, and a third sparsity type, the first sparsity type having a higher level than the second sparsity type, and the second sparsity type having a higher level than the third sparsity type; executing a corresponding image compression strategy on the first image based on the sparsity type of the first image to obtain a compressed second image; evaluating a display effect of the second image to obtain a first evaluation result; In a case where the first evaluation result does not meet the display requirement of the second image, the image compression strategy is adjusted to optimize the display effect of the second image.

2. The method according to claim 1, characterized in that The analyzing the sparsity of the first image to determine the sparsity type of the first image includes: Determining a first number of first pixels included in the first image, and determining a first ratio of the first number of the first pixels to a second number of all pixels included in the first image; wherein the pixel values of the first pixels are non-zero; Based on the first ratio, a sparsity type of the first image is determined.

3. The method according to claim 1, characterized in that The step of performing a corresponding image compression strategy on the first image based on the sparsity type of the first image to obtain a compressed second image includes: determining, based on a first ratio of a first number of first pixels included in the first image to a second number of all pixels included in the first image, an image compression strategy of a sparsity type for the first image, wherein the first ratio includes a first parameter range, a second parameter range, and a third parameter range, a value of the first parameter range is higher than that of the second parameter range, and a value of the second parameter range is higher than that of the third parameter range; Based on the sparsity type of the first image, one or more image compression strategies are performed on the first image to obtain a compressed second image.

4. The method according to claim 3, characterized in that The method further includes executing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image: When the first ratio is within a first parameter range, determining that the sparsity type of the first image is a first type of sparsity; When the sparsity type of the first image is the first type of sparsity, the first image is compressed by using a segmented storage compression or a differential storage compression method to obtain a compressed second image.

5. The method according to claim 3, characterized in that The method further includes executing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image: When the first ratio is within a second parameter range, determining that the sparsity type of the first image is a second type of sparsity; In a case where the sparsity type of the first image is the second type of sparsity, the first image is compressed using a quality compression method to obtain a compressed second image.

6. The method according to claim 3, characterized in that The method further includes executing one or more image compression strategies on the first image based on the sparsity type of the first image to obtain a compressed second image: When the first ratio is within a third parameter range, determining that the sparsity type of the first image is a third type of sparsity; When the sparsity type of the first image is the third type of sparsity, the first image is compressed using a sampling rate compression method to obtain a compressed second image.

7. The method according to claim 1, characterized in that The evaluating the display effect of the second image to obtain a first evaluation result includes: Evaluate the resolution, color depth, file size, and compression effect of the second image to obtain a plurality of first sub-evaluation results corresponding to the respective images; In the case that one or more of the plurality of first sub-evaluation results do not meet the display requirements of the second image, multiple image compression methods are adopted or the current image compression method is changed to optimize the display effect of the second image.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the steps of the image processing method according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the steps of the image processing method according to any one of claims 1 to 7 are implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the image processing method according to any one of claims 1 to 7 are implemented.