Image storage processing method, apparatus and readable storage medium

CN118034573BActive Publication Date: 2026-08-14TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-02
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]但是,本申请发明人在实际研发过程中发现:应用程序的工程目录中存储有大量的本地图像资源,而工程目录的不同文件夹下通常会存储有大量相同或相似的图像资源,从而导致占用了大量的终端存储空间

Benefits of technology

本申请实施例通过从待存储图像集合中获取待存储的相似图像集合,对相似图像集合进行采样处理,得到相似图像集合的采样图像;基于采样图像进行压缩编码处理,得到相似图像集合的编码数据流作为相似图像集合的位图进行存储;其中对相似图像集合进行采样处理后可以将相似图像集合中的多个图像采样为一个图像进行压缩编码处理,由此可以将相似图像集合中多个相同或相似的图像进行压缩编码为一个位图进行存储,而无需对大量相同或相似的图像分别进行重复存储,从而降低了图像的存储数据量,降低了图像存储所需占用的存储空间,在一定程度上降低工程目录中大量相同或相似图像资源存储时所需占用的存储空间。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118034573B_ABST
    Figure CN118034573B_ABST
Patent Text Reader

Abstract

This application discloses an image storage processing method, apparatus, and readable storage medium. It can obtain a set of similar images to be stored from a set of images to be stored; perform sampling processing on the similar image set to obtain sampled images of the similar image set; perform block processing based on the sampled images to obtain image blocks of the sampled images; perform transformation processing on each image block to obtain a coefficient matrix of each image block; perform compression encoding processing on the coefficient matrix of each image block to determine the encoding information of each image block, obtaining an encoded data stream of the similar image set, wherein the encoded data stream includes the encoding information of each image block; and store the encoded data stream as a bitmap of the similar image set. This application can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving. This solution can reduce the storage space required when storing a large number of identical or similar image resources in a project directory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to an image storage and processing method, apparatus, and computer-readable storage medium. Background Technology

[0002] An application (APP) is a computer program designed to perform one or more specific tasks. It runs in user mode and can interact with the user. To meet people's application needs, various applications are usually installed on devices such as smartphones and tablets.

[0003] However, the inventors of this application discovered during the actual research and development process that the application's project directory stores a large number of local image resources, and different folders in the project directory usually store a large number of the same or similar image resources, which results in a large amount of terminal storage space being occupied. Summary of the Invention This application provides an image storage processing method, apparatus, computer device, and computer-readable storage medium, which can reduce the storage space required when storing a large number of identical or similar image resources in a project directory.

[0004] In a first aspect, embodiments of this application provide an image storage and processing method, the method comprising: Obtain a set of similar images to be stored from the set of images to be stored, wherein the set of similar images includes at least two images; The similar image set is sampled to obtain a sampled image of the similar image set; The sampled image is divided into blocks to obtain each image block of the sampled image; The image blocks are transformed to obtain the coefficient matrix of each image block; The coefficient matrix of each image block is compressed and encoded to determine the encoding information of each image block, thereby obtaining the encoded data stream of the similar image set, wherein the encoded data stream includes the encoding information of each image block; The encoded data stream is stored as a bitmap of the set of similar images.

[0005] Secondly, embodiments of this application provide an image storage and processing apparatus, the image storage and processing apparatus comprising: An acquisition unit is configured to acquire a set of similar images to be stored from a set of images to be stored, wherein the set of similar images includes at least two images; A processing unit is used to perform sampling processing on the set of similar images to obtain a sampled image of the set of similar images; The processing unit is further configured to perform block processing based on the sampled image to obtain each image block of the sampled image; The processing unit is further configured to perform transformation processing on each image block to obtain the coefficient matrix of each image block; The processing unit is further configured to perform compression encoding processing on the coefficient matrix of each image block to determine the encoding information of each image block and obtain the encoded data stream of the similar image set, wherein the encoded data stream includes the encoding information of each image block; A storage unit is used to store the encoded data stream as a bitmap of the similar image set.

[0006] Thirdly, embodiments of this application also provide a computer device, the computer device including a processor and a memory, the memory storing a computer program, and the processor executing any of the image storage processing methods provided in embodiments of this application when calling the computer program in the memory.

[0007] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to execute the image storage processing method described above.

[0008] Fifthly, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement any of the image storage and processing methods provided in the embodiments of this invention.

[0009] From the above, it can be concluded that the embodiments of this application have the following beneficial effects: This application embodiment obtains a set of similar images to be stored from a set of images to be stored, performs sampling processing on the set of similar images to obtain a sampled image of the set of similar images, and performs compression encoding processing on the sampled image to obtain an encoded data stream of the set of similar images as a bitmap for storage. In this embodiment, after sampling processing of the set of similar images, multiple images in the set of similar images can be sampled into one image for compression encoding processing. This allows multiple identical or similar images in the set of similar images to be compressed and encoded into one bitmap for storage, without having to repeatedly store a large number of identical or similar images separately. This reduces the amount of image storage data and the storage space required for image storage, and to a certain extent reduces the storage space required when storing a large number of identical or similar image resources in the project directory. Attached Figure Description To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This is a schematic diagram illustrating an application scenario of the image storage and processing method provided in the embodiments of this application; Figure 2 This is a schematic flowchart of an embodiment of the image storage and processing method provided in this application. Figure 3 This is a schematic diagram of an architecture of the feature extraction network provided in the embodiments of this application; Figure 4 This is an illustrative diagram illustrating the acquisition of a set of similar images provided in an embodiment of this application; Figure 5 This is an illustrative diagram illustrating the image block compression coding provided in the embodiments of this application; Figure 6 This is a schematic diagram illustrating the scanning order of the coefficient matrix provided in the embodiments of this application; Figure 7 This is an illustrative diagram of a set of similar images provided in the embodiments of this application; Figure 8 A schematic diagram of an embodiment of the image storage and processing device in this application; Figure 9 A schematic diagram of the structure of the computer device involved in the embodiments of this application. Detailed Implementation The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0011] In the description of the embodiments of this application, it should be understood that the terms "first" and "second" are used to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features, rather than being used to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.

[0012] This application provides an image storage and processing method, apparatus, computer device, and computer-readable storage medium. The image storage and processing apparatus can be integrated into a computer device, which can be a server or a user terminal, etc. The user terminal includes, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, and aircraft.

[0013] The image storage processing method of this embodiment can be implemented by a server or jointly by a terminal and a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, but is not limited to these. The terminal can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0014] The following example illustrates this image storage and processing method using both a terminal and a server.

[0015] refer to Figure 1 The image storage and processing system provided in this embodiment of the invention includes a terminal 101 and a server 102, etc.; the terminal 101 and the server 102 are connected through a network, such as through a wired or wireless network.

[0016] Terminal 101 can be a terminal providing a set of similar images. For example, terminal 101 can compile the project file of an application to obtain all image resources under the executable file, which serves as a set of images to be stored. It can then retrieve the set of similar images to be stored from the set of images to be stored and send the set of similar images to server 102. Server 102 can receive the set of similar images sent by terminal 101, perform sampling processing on the set of similar images to obtain sampled images of the set of similar images, perform block processing based on the sampled images to obtain each image block of the sampled images, perform transformation processing on each image block to obtain the coefficient matrix of each image block, perform compression encoding processing on the coefficient matrix of each image block to determine the encoding information of each image block, and obtain an encoded data stream of the set of similar images, wherein the encoded data stream includes the encoding information of each image block; and store the encoded data stream as a bitmap of the set of similar images.

[0017] The image storage and processing method provided in this embodiment may specifically involve artificial intelligence cloud services. The following description takes a computer device as the execution subject of the image storage and processing method as an example. For the sake of simplicity, the execution subject will be omitted in the following text.

[0018] Artificial intelligence cloud services are generally also known as AIaaS (AI as a Service). This is currently a mainstream service model for artificial intelligence platforms. Specifically, AIaaS platforms break down several common AI services and provide them as independent or packaged services in the cloud. This service model is similar to opening an AI-themed marketplace: all developers can access and use one or more AI services provided by the platform through API interfaces. Some experienced developers can also use the AI ​​framework and AI infrastructure provided by the platform to deploy and maintain their own dedicated cloud AI services.

[0019] The following is a detailed description in conjunction with the accompanying drawings. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the drawings.

[0020] like Figure 2 As shown, the specific flow of this image storage and processing method can be summarized in steps 201 to 206, wherein: 201. Obtain the set of similar images to be stored from the set of images to be stored.

[0021] The set of similar images includes at least two images, and similar images refer to images in the set of similar images.

[0022] In this context, images in a set of similar images are considered to be identical or similar if the similarity between any two images is greater than a preset similarity threshold.

[0023] In step 201, there are several ways to obtain a set of similar images, including, for example: (1) Real-time filtering of identical or similar images from the image set to be stored to obtain a similar image set. For example, obtaining the similar image set may specifically include the following steps 2011-2013: 2011. Obtain the set of images to be stored.

[0024] The set of images to be stored includes at least two images.

[0025] Taking "storing images from the application's project file to the terminal" as an example, the app's installation package is an executable file obtained by compiling the project file. The image resources in the executable file are all the images in the project file. Because an app is often developed collaboratively by multiple developers, the same or similar images may be stored in different folders within a single project file. Therefore, the process first identifies the same or similar images in different folders within a project file, then compresses and encodes them using the compression encoding method described in this embodiment before storing them. First, before launching the application, the project file of the application to be installed on the terminal can be obtained. Then, the project file is compiled to obtain all the images within it. At this point, the set of all images in the project file can be used as the image set to be stored. Thus, the image set to be stored can be obtained.

[0026] 2012. Obtain the feature information of each image to be stored in the image set to be stored.

[0027] The images to be stored refer to the images that need to be stored, specifically the images in the set of images to be stored.

[0028] The feature information of the image to be stored refers to the representation vector of the features of the image to be stored. For example, the representation vector of features such as image color information, image reference information (such as the homepage, subpage, H5 page, or playback page where the image in the project file is located, as mentioned in step 2011).

[0029] Specifically, the color information of the image to be stored can be the color value of each pixel in each color channel (such as R channel, G channel, B channel).

[0030] The reference information for the image to be stored refers to the reference details of the image, such as its application scenario and the application page. The application page refers to the page in the application where the image to be stored is displayed. For example, if image 1 in the project file is displayed on the application's homepage and playback page, then the homepage and playback page can be used as reference information for image 1.

[0031] There are multiple ways to obtain feature information in step 2012, including, for example: (1) In some embodiments, the feature information can be the visual feature vector of the image to be stored. In this case, the color information of each image to be stored can be vectorized to obtain the visual feature vector of each image to be stored, thereby obtaining the feature vector of each image to be stored. For example, if the set of images to be stored includes image 1, image 2, image 3, image 4, image 5, and image 6, then the color information of image 1, image 2, image 3, image 4, image 5, and image 6 can be vectorized to obtain the visual feature vectors of image 1, image 2, image 3, image 4, image 5, and image 6.

[0032] (2) In other embodiments, the feature information can be the concatenation result between the visual feature vector and the reference feature vector of the image to be stored. In this case, the color information of each image to be stored can be vectorized to obtain the visual feature vector of each image to be stored; and the reference information of each image to be stored can be vectorized to obtain the reference feature vector of each image to be stored. Then, the visual feature vector and the reference feature vector of each image to be stored are concatenated to obtain the concatenated feature vector as the feature information of each image to be stored. For example, if the set of images to be stored includes image 1 and image 2, then the color information of image 1 and image 2 are vectorized to obtain the visual feature vectors of image 1 and image 2, and the reference information of image 1 and image 2 is vectorized to obtain the reference feature vectors of image 1 and image 2; then, the visual feature vector of image 1 and the reference feature vector of image 1 are concatenated to obtain the feature information of image 1; and the visual feature vector of image 2 and the reference feature vector of image 2 are concatenated to obtain the feature information of image 2.

[0033] 2013. Based on the feature information of each image to be stored, similarity clustering is performed on each image to be stored in the image set to be stored to obtain a set of similar images.

[0034] To facilitate understanding, the feature extraction network provided in this embodiment will be introduced below, such as... Figure 3 As shown, the feature extraction network may include a first extraction module and a second extraction module.

[0035] The first extraction module performs preliminary feature extraction processing on the feature information of the image to obtain preliminary features of the image. For example, it performs preliminary feature extraction processing on the feature information of the image to be stored to obtain preliminary features of the image to be stored. Similarly, it performs preliminary feature extraction processing on the feature information of a sample image to obtain preliminary features of the sample image.

[0036] The second extraction module is used to perform further feature extraction processing based on the preliminary features of the image to obtain detailed features. For example, it performs further feature extraction processing based on the preliminary features of the image to be stored to obtain detailed features of the image to be stored. Similarly, it performs further feature extraction processing based on the preliminary features of a sample image to obtain detailed features of the image to be stored.

[0037] For example, the feature extraction network can employ a convolutional neural network (CNN), with the convolutional layers of the CNN serving as the first extraction module, and the activation layers and pooling layers of the CNN serving as the second extraction module. For instance, the convolutional layers of algorithms such as SIFT, SURF, or Haar can be used as the first extraction module, and the parts of the SIFT, SURF, or Haar algorithms other than the convolutional layers can serve as the second extraction module.

[0038] During the training phase of the feature extraction network, the distance between the preliminary features of two similar sample images can be used as the loss value. The model parameters (such as kernel size) of the first extraction module are adjusted to minimize this distance. Similarly, the distance between the detailed features of two similar sample images can be used as the loss value. The model parameters (such as pooling layer parameters, activation layer parameters, window size, and window stride) of the second extraction module are adjusted to minimize this distance. This results in a feature extraction network that can be used for both preliminary and detailed feature extraction of images. The distance between the preliminary features of two similar sample images can be calculated using methods such as cosine similarity.

[0039] CNNs are a type of feedforward neural network whose artificial neurons can respond to surrounding units within a certain coverage area, exhibiting excellent performance in large-scale image processing. A CNN consists of one or more convolutional layers and a fully connected layer at the top (corresponding to a classic neural network), as well as correlation weights and pooling layers. This structure allows the convolutional neural network to utilize the two-dimensional structure of the input data. This embodiment can use a CNN to extract identical or similar images from a set of images to be stored, forming a set of similar images.

[0040] There are several ways to obtain a set of similar images through similarity clustering in step 2013, including, for example: (1) Perform a similarity clustering on the set of images to be stored to obtain a set of similar images. For example, input the feature information of each image to be stored into the feature extraction network provided in this embodiment, and sequentially extract features through the first extraction module and the second extraction module of the feature extraction network to obtain the detailed features of each image to be stored; compare the distance between the detailed features of each image to be stored to determine whether the images to be stored are the same or similar, thereby obtaining a set of similar images. For example, at this time, step 2013 may specifically include the following steps A1 to A3: A1. Based on the feature information of each image to be stored, feature extraction is performed to obtain the image features of each image to be stored.

[0041] For example, the feature information of each image to be stored can be input into the feature extraction network provided in this embodiment. First, the first extraction module of the feature extraction network performs preliminary feature extraction based on the feature information of each image to be stored to obtain preliminary features of each image to be stored. Then, the second extraction module performs further feature extraction based on the preliminary features to obtain detailed features of each image to be stored. The obtained detailed features of each image to be stored are used as the image features of each image to be stored. For example, if the set of images to be stored includes image 1, image 2, image 3, image 4, image 5, and image 6, then image 1 will be subjected to feature extraction sequentially through the first extraction module and the second extraction module to obtain the image features of image 1; similarly, the image features of images 2, 3, 4, 5, and 6 can be obtained respectively.

[0042] A2. Based on the image features of each image to be stored, perform similarity clustering on each image in the image set to be stored to obtain a set of similar images.

[0043] For example, please refer to Figure 4 Step A2 may specifically include: obtaining reference images from the unclustered images in the image set to be stored and clustering them into a newly created category set; obtaining comparison images from the unclustered images in the image set to be stored; obtaining the similarity between the reference image and the comparison image based on the distance between the image features of the reference image and the image features of the comparison image; if the similarity is greater than a preset similarity threshold, adding the comparison image to the category set; until the clustering of each image in the image set to be stored is completed, the category set is used as the similar image set.

[0044] For example, please refer to Figure 4 In step A2, the process of performing similarity clustering on each image to be stored in the image set to obtain a similar image set can be shown in steps a to g as follows: a. Iterate through each image in the image set to be stored, retrieve the first image from the image set to be stored, create a new category set, and cluster the first image into the newly created category set.

[0045] b. Obtain the i-th image from the set of images to be stored, and determine the set of existing categories.

[0046] c. Obtain the i-th image from the set of images to be stored, calculate the distance between the image features of the i-th image and the image features of the reference image, and determine the similarity between the i-th image and the reference image.

[0047] The reference image refers to the clustered image among the images to be stored in the image set. Specifically, it refers to the image in the currently existing category set.

[0048] The smaller the distance between the image features of the i-th image and the image features of the reference image, the higher the similarity between the i-th image and the reference image; conversely, the larger the distance between the image features of the i-th image and the image features of the reference image, the lower the similarity between the i-th image and the reference image.

[0049] d. If the similarity between the i-th image and the reference image is greater than the preset similarity threshold (e.g., 70%), then the i-th image is added to the category set of the reference image.

[0050] e. If the similarity between the i-th image and the reference image is less than or equal to the preset similarity threshold (e.g., 99%), then a new category set is created, and the i-th image is added to the new category set.

[0051] The preset similarity threshold can be set according to the actual business scenario requirements, and is not limited to the example given here.

[0052] f. Using i=i+1, that is, the (i+1)th image as the i-th image in step b, repeat steps be above until all images in the image set to be stored have been traversed, resulting in multiple category sets.

[0053] g. Count the number of images in each category set obtained in step f. If the number of images in a category set is greater than or equal to 2, then that category set is considered a similar image set. Thus, one or more similar image sets can be obtained. Each similar image set can be used as the similar image set in step 201, and then compressed and encoded in steps 202-205 before storage. This allows each image in the similar image set to be compressed and stored as a single bitmap, thereby reducing the storage space required for storing identical or similar images, saving terminal image storage space, and improving image reading efficiency.

[0054] Bitmap images, also known as raster images or pixel images, are composed of individual points called pixels. These points can be arranged and colored differently to form patterns. This embodiment compresses and stores a set of similar images by modifying the bit depth of the bitmap. Bit depth refers to the number of bits a computer uses to represent the color of a digital image. Computers can display colors by using a unit of counting called a "bit" to record the data representing the color. When this data is recorded in a computer according to a certain arrangement, it constitutes a computer file of a digital image. A "bit" is the smallest unit in computer memory, used to record the color value of each pixel. The richer the colors of an image, the more bits are needed. The number of bits used for each pixel in the computer is called the "bit depth."

[0055] For example, performing similarity clustering on images 1, 2, 3, 4, 5, and 6 in a set of images to be stored yields three category sets: {Image 1}, {Image 2, Image 3}, and {Image 4, Image 5, Image 6}. Then, {Image 2, Image 3} and {Image 4, Image 5, Image 6} can be considered as sets of similar images, respectively. As another example... Figure 7 As shown, by performing similarity clustering on all images in the project file, identical or similar images in different folders within the project file can be found, such as... Figure 7 The two images selected by the rectangle are the same image (the image named "financial_trade_icon" is located in the folder named "financial", and the image named "entrance_indicator" is located in the folder named "home"). These two identical images can form a set of similar images.

[0056] (2) First, perform a similarity clustering on the set of images to be stored to obtain each cluster image set. Then, perform a second similarity clustering on the cluster set containing more than 2 images to obtain a similar image set. For example, first, extract the preliminary features of the images to be stored through the first extraction module, and perform a first clustering using the distance between the preliminary features of the images to be stored to obtain each cluster image set. Then, extract the detailed features of each cluster image in the cluster set (here referring to the cluster set containing more than 2 images) through the second extraction module, and perform a second clustering using the distance between the preliminary features of the cluster images to obtain a similar image set. This reduces the number of images that need to have detailed features extracted, thereby improving the speed of obtaining the similar image set. For example, at this time, step 2013 may specifically include the following steps B1 to B4: B1. Based on the feature information of each image to be stored, perform preliminary feature extraction to obtain the preliminary features of each image to be stored.

[0057] The preliminary features are obtained by performing preliminary feature extraction on the feature information of each image to be stored. For example, the preliminary feature extraction mainly involves the recognition of features such as the contour of the edge part, which can be extracted using the first extraction module (such as a convolutional layer).

[0058] For example, the feature information of each image to be stored can be input into the feature extraction network provided in this embodiment. The first extraction module of the feature extraction network performs preliminary feature extraction based on the feature information of each image to be stored to obtain the preliminary features of each image to be stored. For example, if the set of images to be stored includes image 1, image 2, image 3, image 4, image 5, and image 6, then image 1 will be processed sequentially through the first extraction module to obtain the preliminary features of image 1; similarly, the preliminary features of images 2, 3, 4, 5, and 6 can be obtained respectively.

[0059] B2. Based on the preliminary features of each image to be stored, perform similarity clustering on each image in the image set to be stored to obtain the clustered image sets of the image set to be stored.

[0060] The clustered image set includes at least two images.

[0061] For example, referring to steps a~g above, the "distance between the image features of the i-th image and the image features of the reference image" used to determine the similarity between the i-th image and the reference image in step b can be replaced with "the distance between the initial features of the i-th image and the initial features of the reference image", and the "similar image set" obtained in step g can be replaced with "clustered image set". In this way, similarity clustering can be performed based on the preliminary features of each image to be stored to obtain each clustered image set of the image set to be stored.

[0062] For example, if we perform similarity clustering on images 1, 2, 3, 4, 5, and 6 in the image set to be stored, we obtain three category sets: {Image 1}, {Image 2, Image 3}, and {Image 4, Image 5, Image 6}. Then, we can use {Image 2, Image 3} and {Image 4, Image 5, Image 6} as the clustered image sets respectively.

[0063] B3. Based on the preliminary features of each cluster image in the cluster image set, detailed feature extraction is performed on each cluster image to obtain the detailed features of each cluster image.

[0064] Clustered images refer to images within a clustered image set.

[0065] Among them, detailed features are the detailed features extracted from the feature information of each image to be stored. For example, detailed feature extraction mainly involves the recognition of complex structural features such as the graphic structure of the image, which can be extracted using the second extraction module.

[0066] For example, the second extraction module can be used to perform further feature extraction based on the preliminary features of each cluster image in the cluster image set to obtain the detailed features of each cluster image.

[0067] B4. Based on the detailed features of each clustered image, perform similarity clustering on each clustered image in the clustered image set to obtain a similar image set.

[0068] For example, referring to steps a~g above, the “set of images to be stored” can be replaced with the “set of clustered images”, and the “distance between the image features of the i-th image and the image features of the reference image” used in step b to determine the similarity between the i-th image and the reference image can be replaced with the “distance between the detailed features of the i-th image and the detailed features of the reference image”. In this way, similarity clustering can be performed based on the detailed features of each clustered image to obtain a set of similar images.

[0069] It is understandable that for each clustered image set obtained in step B2, secondary similarity clustering is performed in accordance with the methods in steps B3 to B4 to determine the set of similar images under each clustered image set.

[0070] For example, if a secondary similarity clustering is performed on the clustered image set {Image 2, Image 3}, images 2 and 3 will be clustered into two different category sets (e.g., set 1 and set 2 respectively). Then, the set of similar images under the clustered image set {Image 2, Image 3} will be empty. If a secondary similarity clustering is performed on the clustered image set {Image 4, Image 5, Image 6}, image 4 will be clustered into one category set (e.g., set 3), and images 5 and 6 will be clustered into another category set (e.g., set 4). Then, the set of similar images under the clustered image set {Image 4, Image 5, Image 6} will be {Image 5, Image 6}.

[0071] 202. Perform sampling processing on the set of similar images to obtain the sampled images of the set of similar images.

[0072] Here, similar images refer to images in a set of similar images.

[0073] The sampled image is obtained by sampling each similar image in a set of similar images.

[0074] There are several ways to obtain the sampled image in step 202, including, for example: (1) The color component of each pixel in the sampled image is taken as the average of the color components at the corresponding positions in the set of similar images. Please refer to... Figure 5 At this point, step 202 may specifically include the following steps 2021A to 2023A: 2021A. Obtain the initial color components of each similar image in the similar image set, as well as the sampling ratio of the similar image set.

[0075] The initial color component refers to the color component before sampling.

[0076] In some embodiments, the color components can specifically be the Y component, Cb component, and Cr component in the YCrCb color space. Here, Y, Cr, and Cb represent brightness, chromaticity, and saturation, respectively, and Y, Cb, and Cr can be represented by Y, U, and V, respectively.

[0077] The sampling ratio is the ratio of the Y component, Cb component, and Cr component. For example, Y:Cb:Cr can be 4:1:1 or 4:4:4, etc. Taking Y:Cb:Cr=4:1:1 as an example, this means that in a 2×2 cell, there should be 4 Y, 4 U, and 4 V values, requiring 12 bytes of storage. After 4:1:1 sampling, each cell contains 4 Y, 1 U, and 1 V values, requiring only 6 bytes of storage.

[0078] For example, such as Figure 5 As shown, taking "storing images from the application's project file to the terminal" as an example, when the application starts, it first performs color conversion on each similar image in the similar image set to obtain the initial color components of each similar image. For example, it first converts each similar image from the RGB color space to the YCrCb color space; and obtains the name and path of each similar image. Then, it uses the imread function to read the image data according to the name and path of each similar image, thereby obtaining the initial color components of each similar image. Specifically, this image data can be an M*N*3 array, which contains information about the Y component, Cb component, and Cr component of the similar image.

[0079] In other embodiments, the color components can specifically be the R, G, B, and A components in the RGB color space. Taking "storing images from the application's project file to the terminal" as an example, when the application starts, the colors of each similar image in the similar image set are first converted to obtain the initial color components of each similar image. The names and paths of each similar image are then obtained. Finally, the `imread` function reads the image data based on the names and paths of each similar image, thus obtaining the initial color components of each similar image. Specifically, this image data can be an M*N*4 array, containing the R, G, B, and A components of the similar images.

[0080] 2022A. Based on the sampling ratio, the initial color components of each similar image are sampled to obtain the sampled color components of each similar image.

[0081] For example, taking a similar image set including 3 images (image 1, image 2 and image 3) with a sampling ratio of 4:1:1, then according to the sampling ratio of 4:1:1, image 1, image 2 and image 3 are sampled respectively to obtain the sampled color components of image 1, image 2 and image 3.

[0082] 2023A. After sampling, the color components of each similar image are averaged to obtain the sampled image of the similar image set.

[0083] To facilitate understanding, continuing from the example in step 2023A above, specifically, the average of the sampled color components of image 1, image 2, and image 3 is taken as the sampled color components of the similar image set, thus obtaining the sampled image of the similar image set. The obtained sampled image is essentially the source image data, which contains the sampled color components of each location point.

[0084] (2) The color component of each pixel in the sampled image is taken as the median of the color components at the corresponding position in each image of the similar image set. In this case, step 202 may specifically include the following steps 2021B to 2023B: 2021B: Obtain the initial color components of each similar image in the similar image set, as well as the sampling ratio of the similar image set.

[0085] 2022B. Based on the sampling ratio, the initial color components of each similar image are sampled to obtain the sampled color components of each similar image.

[0086] 2023B. Calculate the median of the color components after sampling each similar image to obtain the sampled image of the similar image set.

[0087] Steps 2021B to 2023B are implemented similarly to steps 2021A to 2023A. For details, please refer to the relevant explanations above, which will not be repeated here.

[0088] 203. Based on the sampled image, perform block processing to obtain each image block of the sampled image.

[0089] Since the subsequent compression encoding process is based on image blocks of n*n=8*8 points, the sampled image needs to be divided into M*N image blocks. Each image block is a pixel of the sampled image, and each pixel corresponds to an 8*8 data unit matrix.

[0090] 204. Perform transformation processing on each image block to obtain the coefficient matrix of each image block.

[0091] Please refer to Figure 5 For example, firstly, a Discrete Cosine Transform (DCT) is performed on the 8*8 data cell matrix corresponding to each image block to obtain the transformed 8*8 matrix for each image block. Then, the transformed 8*8 matrix corresponding to each image block is divided by the quantization matrix and the result is rounded down to quantize the transformed 8*8 matrix corresponding to each image block, thus obtaining the coefficient matrix for each image block. At this point, the obtained coefficient matrix is ​​still an 8*8 matrix; the first coefficient value in the coefficient matrix of the image block is called the DC coefficient (DC coefficient for short), and the remaining 63 coefficients in the coefficient matrix excluding the DC coefficient are the AC coefficients (AC coefficients for short).

[0092] 205. Compress and encode the coefficient matrix of each image block to determine the encoding information of each image block and obtain the encoded data stream of the similar image set.

[0093] The encoded data stream includes the encoding information for each image block.

[0094] In step 205, there are various ways to compress and encode the coefficient matrix of each image block to obtain the encoding information of each image block. For example, these include: (1) Furthermore, in order to reduce the storage space of the compression encoding process, the AC coefficients are first run-length encoded and then the mapping replacement process is performed during the AC encoding process of compression encoding, so as to accelerate the data query speed. The specific mapping replacement process can be referred to in steps 2051 to 2054 below: 2051. Perform intermediate encoding processing on the DC coefficient to obtain the first encoded data of the DC coefficient.

[0095] The first encoded data refers to the intermediate format of the DC coefficients obtained after format encoding of the DC coefficients.

[0096] To save storage space, the DC coefficients in the coefficient matrix do not store specific numerical values, but are stored according to the encoding rules of the VLI encoding table. As shown in Table 1, the VLI encoding table records the group to which each specific value belongs and the actual stored value. For example, the specific value "-2" belongs to group 2, and its actual stored value is 01.

[0097] Table 1

[0098] For example, the specific process of format encoding the DC coefficient is as follows: determine the difference between the DC coefficient of the current image block and the DC coefficient of the previous image block (e.g., the difference is 3), then query the VLI encoding table to determine the group (i.e., the second group) where the value 3 is located, and then the first encoded data of the DC coefficient can be written in the form of (2)(3).

[0099] 2052. Perform run-length encoding on the AC coefficients to obtain the run-length encoded sequence of the AC coefficients.

[0100] Among them, the run-length encoded sequence refers to the encoded data obtained after running-length encoding the AC coefficients.

[0101] Please refer to Figure 6 For example, the coefficient matrix of an image block can be scanned according to a preset scanning order (such as Zigzag scanning sort; in Zigzag scanning sort, the scanning, saving, and reading of data starts from the top left corner of the 8*8 coefficient matrix and scans in the shape of the English letter Z, hence the name Zigzag scanning sort). This scan yields AC coefficients (e.g., "aaaabbbbccccdddeeddaa…"). In the run-length encoded sequence, the first byte represents the number of repetitions, and the second byte represents the repeated string. For example, the run-length encoded sequence corresponding to the AC coefficient "aaaabbbbccccdddeeddaa…" is "4a4b4c3d2e2d2a…". Therefore, "4a4b4c3d2e2d2a…" is the run-length encoded sequence of the AC coefficient "aaaabbbbbccccdddeeddaa…". Among them, 4a, 4b, 4c, 3d, 2e, 2d, 2a represent the run length coding (RLC) of coefficient values ​​a, b, c, d, e, d, a in the AC coefficients.

[0102] 2053. Perform mapping and replacement processing on the strings in the run-length encoded sequence to obtain the mapping sequence of the run-length encoded sequence and the first hash table.

[0103] The first hash table is a mapping table between the mapping sequence and the run-length encoded sequence. Essentially, the first hash table is a hash table showing the relationship between strings in the run-length encoded sequence and their corresponding key values.

[0104] Here, the mapping sequence refers to the data sequence obtained after mapping and replacing the strings in the run-length encoded sequence. For example, the run-length encoded sequence "4a4b4c3d2e2d2a…" is mapped and replaced to obtain "$0_3d_$1", ​​so the mapping sequence of the run-length encoded sequence is "$0_3d_$1"; where the strings "4a4b4c" and "2e2d2a" in the run-length encoded sequence are mapped to "$0" and "$1" respectively. In this case, the first hash table can specifically be a hash table showing the relationship between the strings "4a4b4c" and "2e2d2a" in the run-length encoded sequence and the key values ​​"$0" and "$1".

[0105] HashTable (also called hash table) is a data structure that allows direct access to data stored in memory based on a key. In other words, it maps the data to a location in the table by calculating a key-value pair, thus speeding up the search. This mapping function is called a hash function, and the array storing the records is called a hash table. In this embodiment, storing similar images using a hash table can, on the one hand, speed up data retrieval during compression encoding; on the other hand, by using simple character mapping and replacement for storage, it can reduce storage space during compression, thereby reducing memory allocation and minimizing lag.

[0106] Please refer to Figure 5 For example, a hash function can be used to calculate the key value of consecutive strings in a run-length encoded sequence, and then this key value can be used to replace the consecutive strings, so that the same consecutive strings in the run-length encoded sequence can be represented by the same key value. Furthermore, the mapping and replacement relationships can be recorded using a first hash table, thereby speeding up the search for consecutive strings. For instance, the run-length encoded sequence "4a4b4c3d2e2d2a…" in step 2052 can be subjected to simple character replacement, and the mapping and replacement process yields "$0_3d_$1". Here, "4a4b4c" is mapped to "$0", and "2e2d2a" is mapped to "$1".

[0107] As can be seen, on the one hand, since a hash function can transform an input of arbitrary length into a fixed-length output through a hash algorithm, and this output is the hash value (i.e., the key value), this embodiment uses a hash function to replace continuous strings in the run-length encoded sequence with fixed-length key values. On the one hand, it can replace them with simple characters for storage, which can reduce the data storage length of the run-length encoded sequence, reduce the storage space during the compression process, and thus reduce the scheduling of running memory and reduce stuttering. In particular, it can significantly reduce the stuttering problem when reading data during large image storage on low-end models. On the other hand, reading the structured data during the compression encoding process through the first hash table can speed up the data search speed during the compression encoding process.

[0108] 2054. Based on the mapping sequence and the first hash table, intermediate encoding processing is performed on the AC coefficients to obtain the second encoded data of the AC coefficients.

[0109] The second encoded data refers to the intermediate format of the AC coefficients obtained after format encoding of the AC coefficients.

[0110] For example, as shown in Table 2, when intermediate encoding of the AC coefficients is required, the data 4a4b4c can be read from the first hash table based on the mapping sequence "$0_3d_$1" of the AC coefficients and $0 in the mapping sequence. Thus, the coefficient value (such as a) and its run length code (the run length code of coefficient value a is 4a) can be obtained. At this time, the intermediate encoding format of coefficient value a in the AC coefficients can be: (4a, a). Similarly, the intermediate encoding formats of each coefficient value in the AC coefficients can be obtained. Concatenating them together gives the second encoded data of the AC coefficients.

[0111] Table 2

[0112] 2055. Based on the first and second encoded data, entropy coding is performed to determine the coding information of each image block, and the encoded data stream of the similar image set is obtained.

[0113] In some embodiments, Huffman coding can be directly used to obtain the codewords for DC coefficients from the first encoded data and the codewords for AC coefficients from the second encoded data. The codewords for DC coefficients and AC coefficients are then concatenated to obtain the encoding information for each image block. This process is repeated to obtain the encoding information for each image block, which serves as the encoded data stream for the similar image set. Specifically, when using Huffman coding, the probability of each number appearing is statistically analyzed based on the similar image set (e.g., the coefficient values ​​of DC coefficients in the first encoded data, the run-length codes in the second encoded data, and the coefficient values ​​of AC coefficients in the second encoded data). The probability values ​​of each number are then used to create a Huffman tree. Finally, the Huffman tree is multiplied by a coefficient matrix (e.g., quantized AC coefficients) to achieve encoding.

[0114] In some embodiments, to reduce the storage space required for the compression encoding process, during entropy encoding, identical data in the AC coefficients are mapped and replaced to accelerate data retrieval. In this case, step 2055 can specifically be shown as steps C1-C4 below: C1. Perform entropy encoding on the first encoded data to obtain the codeword of the DC coefficient.

[0115] C2. Perform a mapping and replacement process on the strings in the coefficient values ​​to obtain the mapped values ​​of the coefficient values ​​and the second hash table.

[0116] The second hash table is a mapping table between mapping values ​​and coefficient values. Essentially, the second hash table is a hash table showing the relationship between strings in the coefficient values ​​and their corresponding key values.

[0117] For example, in the coefficient value "0x23143123" of the exchange coefficient, "2314" can be mapped and replaced with "@", and "3123" can be mapped and replaced with "&", thus obtaining the mapped value "0x@&". This is similar to the string mapping and replacement processing in the run-length encoded sequence mentioned earlier. On the one hand, it can reduce the representation length of the coefficient value, reduce the storage space in the compression process, and thus reduce the scheduling of running memory and reduce lag. In particular, it can significantly reduce the lag problem when reading data during large image storage on low-end models. On the other hand, by reading the structure data in the compression encoding process through the second hash table, the data search speed in the compression encoding process can be accelerated.

[0118] C3. Based on the second hash table and mapping value, read the coefficient values ​​contained in the second encoded data and perform entropy encoding processing to obtain the codewords of the AC coefficients.

[0119] For example, as shown in Table 3, when entropy encoding is required for the AC coefficients, if one of the intermediate encoding formats in the second encoded data contains the mapping value "0x@&", then the coefficient value "0x23143123" matching the mapping value "0x@&" is read from the second hash table and used as the coefficient value of that intermediate encoding format. This allows entropy encoding to be performed on the intermediate encoding format to obtain the entropy encoding result (e.g., 1101101). Similarly, the entropy encoding results corresponding to each intermediate encoding format in the second encoded data can be obtained, and concatenating them yields the codewords for the AC coefficients. Therefore, Huffman coding can be used to entropy encode the second encoded data to obtain the codewords for the AC coefficients.

[0120] Table 3

[0121] C4. The codewords of the DC coefficient and the AC coefficient are concatenated to determine the encoding information of each image block, thus obtaining the encoded data stream of the similar image set.

[0122] For example, for the first image block, the codeword for the DC coefficient is 01111, and the codeword for the AC coefficient is 1101101, 000, 000, 000, 111000, 1010. Therefore, the encoding information for the first image block can be determined as: 01111, 1101101, 000, 000, 000, 111000, 1010. Similarly, the encoding information for each image block can be obtained, and the set of encoding information for all image blocks constitutes the encoded data stream of the similar image set.

[0123] After each encoding is completed, compressed data is obtained, which yields the encoded data stream of the similar image set. Furthermore, replacement rules for the mapping process can be added to the header of the code table, where the replacement rules are essentially a first hash table and a second hash table.

[0124] (2) The compression coding method in the JPEG (Joint Photographic Experts Group) image compression algorithm is used to compress and encode the coefficient matrix of each image block to determine the encoding information of each image block and obtain the encoded data stream of the similar image set.

[0125] 206. Store the encoded data stream as a bitmap of a set of similar images.

[0126] For example, if a set of similar images includes image 1, image 2, and image 3, then by processing as described above, an encoded data stream of the similar image set is obtained. This encoded data stream is essentially a bitmap, which is then stored instead of storing image 1, image 2, and image 3 separately. Thus, multiple identical or similar images can be stored as a single bitmap. When it is necessary to read any image from the set of similar images (such as image 2), only the bitmap needs to be decoded to obtain the recovered image. During the decoding process, the bitmap data is simply restored according to the code table, and inverse quantization is performed to obtain the recovered image.

[0127] As can be seen from the above, by obtaining a set of similar images to be stored from the set of images to be stored, sampling processing is performed on the set of similar images to obtain a sampled image of the set of similar images; based on the sampled image, compression encoding processing is performed to obtain the encoded data stream of the set of similar images as a bitmap for storage; wherein, after sampling processing of the set of similar images, multiple images in the set of similar images can be sampled into one image for compression encoding processing, thereby compressing and encoding multiple identical or similar images in the set of similar images into one bitmap for storage, without having to repeatedly store a large number of identical or similar images separately, thus reducing the amount of image storage data, reducing the storage space required for image storage, and to a certain extent reducing the storage space required when storing a large number of identical or similar image resources in the project directory.

[0128] For ease of understanding, combined with Figure 4 and Figure 5 Taking "storing images from the application's project files to the terminal" as an example, the image storage processing procedure in this embodiment is explained as follows: 1) Compile the sample project file to obtain the executable file of the sample project file. Use the image resources in the executable file of the sample project file as sample images. Construct the feature information of the sample images based on the reference information and the sample images. Train the feature extraction network to obtain the trained feature extraction network.

[0129] 2) Compile the project file of the application to be installed on the terminal to obtain a working file; use the image resources in the executable file as images to be stored to obtain a set of images to be stored.

[0130] 3) Obtain the feature information of each image to be stored. The feature information can be the visual feature vector and the reference feature vector of the image to be stored. The reference feature vector is the representation vector of the reference information such as the application scenario and application page of the image to be stored.

[0131] 4) Using the trained feature extraction network, extract the image features of each image to be stored based on its feature information; based on the image features of each image to be stored, perform similarity clustering on the images to be stored in the image set to obtain a set of similar images in the image set to be stored. For detailed process, please refer to the relevant explanations in steps 2011 to 2013, which will not be repeated here.

[0132] 5) Sample the set of similar images to obtain a sampled image of the set. Specifically, when the application starts, the colors of each similar image in the set are converted, the name and path of each similar image are obtained, and the imread function is used to convert each similar image into an IM object based on its name and path. The IM is rounded down and divided by the height to obtain max_row (maximum number of rows = M), and the IM is rounded down and divided by the width to obtain max_col (maximum number of columns = N). This allows the application to read and sample each similar image when it starts, obtaining an M*N sampled image. For detailed instructions in step 202, please refer to the relevant descriptions; they will not be repeated here.

[0133] 6) Perform block processing on the sampled image to obtain each image block of the sampled image. For detailed process, please refer to the relevant description in step 203, which will not be repeated here.

[0134] 7) Perform transformation processing on each image block to obtain the coefficient matrix of each image block. For detailed process, please refer to the relevant explanation in step 204, which will not be repeated here.

[0135] 8) Compress and encode the coefficient matrix of each image block to determine the encoding information of each image block, thus obtaining the encoded data stream of the similar image set. For detailed procedures, please refer to the relevant explanation in step 205; they will not be repeated here.

[0136] 9) Store the encoded data stream of the similar image set as a bitmap of the similar image set.

[0137] To better implement the image storage processing method in the embodiments of this application, an image storage processing device is also provided in the embodiments of this application, which can be integrated into computer equipment, such as servers or terminals.

[0138] For example, such as Figure 8 As shown, Figure 8 This is a schematic diagram of an embodiment of the image storage and processing device in this application. The image storage and processing device may include an acquisition unit 801, a processing unit 802, a storage unit 803, etc., as follows: The acquisition unit 801 is used to acquire a set of similar images to be stored from the set of images to be stored, wherein the set of similar images includes at least two images; The processing unit 802 is used to perform sampling processing on the set of similar images to obtain a sampled image of the set of similar images; The processing unit 802 is also used to perform block processing based on the sampled image to obtain each image block of the sampled image; The processing unit 802 is also used to perform transformation processing on each image block to obtain the coefficient matrix of each image block; The processing unit 802 is also used to perform compression encoding processing on the coefficient matrix of each image block to determine the encoding information of each image block and obtain the encoded data stream of the similar image set, wherein the encoded data stream includes the encoding information of each image block; Storage unit 803 is used to store the encoded data stream as a bitmap of a set of similar images.

[0139] In some embodiments, the coefficients of each image block include DC coefficients and AC coefficients, and the processing unit 802 is specifically used for: The DC coefficient is processed by intermediate encoding to obtain the first encoded data of the DC coefficient. Run-length encoding is performed on the AC coefficients to obtain the run-length encoded sequence of the AC coefficients; The strings in the run-length encoded sequence are mapped and replaced to obtain the mapping sequence of the run-length encoded sequence and the first hash table, where the first hash table is a mapping relationship table between the mapping sequence and the run-length encoded sequence; Based on the mapping sequence and the first hash table, intermediate encoding processing is performed on the AC coefficients to obtain the second encoded data of the AC coefficients. Entropy coding is performed based on the first and second encoded data to determine the encoding information of each image block, thereby obtaining the encoded data stream of the similar image set.

[0140] In some embodiments, the AC coefficient includes multiple coefficient values, and the processing unit 802 is specifically used for: Entropy encoding is performed on the first encoded data to obtain the codeword of the DC coefficient; The strings in the coefficient values ​​are mapped and replaced to obtain the mapped values ​​of the coefficient values ​​and the second hash table. The second hash table is a mapping relationship table between the mapped values ​​and the coefficient values. Based on the second hash table and mapping value, the coefficient values ​​contained in the second encoded data are read and entropy encoding is performed to obtain the codewords of the AC coefficients; The codewords of the DC coefficients and AC coefficients are concatenated to determine the encoding information of each image block, thus obtaining the encoded data stream of the similar image set.

[0141] In some embodiments, the processing unit 802 is specifically used for: Obtain the initial color components of each similar image in the similar image set, as well as the sampling ratio of the similar image set; Based on the sampling ratio, the initial color components of each similar image are sampled to obtain the sampled color components of each similar image. The color components of each similar image are averaged to obtain a sampled image of the similar image set.

[0142] In some embodiments, the acquisition unit 801 is specifically used for: Obtain a set of images to be stored, wherein the set of images to be stored includes at least two images; Obtain the feature information of each image to be stored in the image set to be stored; Based on the feature information of each image to be stored, similarity clustering is performed on each image in the image set to be stored to obtain a set of similar images.

[0143] In some embodiments, the acquisition unit 801 is specifically used for: Preliminary feature extraction is performed based on the feature information of each image to be stored, resulting in preliminary features of each image to be stored. Based on the preliminary features of each image to be stored, similarity clustering is performed on each image in the image set to be stored to obtain each clustered image set of the image set to be stored, wherein each clustered image set includes at least two images; Based on the preliminary features of each cluster image in the cluster image set, detailed features are extracted from each cluster image to obtain the detailed features of each cluster image; Based on the detailed features of each clustered image, similarity clustering is performed on each clustered image in the clustered image set to obtain a similar image set.

[0144] In some embodiments, the acquisition unit 801 is specifically used for: Feature extraction is performed on each image to be stored to obtain the image features of each image to be stored. From the unclustered images in the image set to be stored, obtain reference images and cluster them into a newly created category set; Obtain contrast images from the unclustered images in the image set to be stored; The similarity between the reference image and the comparison image is obtained based on the distance between the image features of the reference image and the image features of the comparison image. If the similarity is greater than the preset similarity threshold, the compared image will be added to the category set. Once the clustering of all images in the image set to be stored is completed, the category set will be used as the similar image set.

[0145] As can be seen from the above, the image storage processing apparatus of this application embodiment can obtain a set of similar images to be stored from the set of images to be stored by the acquisition unit 801, wherein the set of similar images includes at least two images; the processing unit 802 performs sampling processing on the set of similar images to obtain a sampled image of the set of similar images; the processing unit 802 performs block processing based on the sampled image to obtain each image block of the sampled image; the processing unit 802 performs transformation processing on each image block to obtain a coefficient matrix of each image block; the processing unit 802 performs compression encoding processing on the coefficient matrix of each image block to determine the encoding information of each image block, thereby obtaining an encoded data stream of the set of similar images, wherein the encoded data stream includes the encoding information of each image block; and the storage unit 803 stores the encoded data stream as a bitmap of the set of similar images.

[0146] Therefore, the image storage processing apparatus provided in this application embodiment can bring the following technical effects: by obtaining a set of similar images to be stored from the set of images to be stored, sampling processing is performed on the set of similar images to obtain a sampled image of the set of similar images; based on the sampled image, compression encoding processing is performed to obtain an encoded data stream of the set of similar images as a bitmap of the set of similar images for storage; wherein after sampling processing of the set of similar images, multiple images in the set of similar images can be sampled into one image for compression encoding processing, thereby multiple identical or similar images in the set of similar images can be compressed and encoded into one bitmap for storage, without having to repeatedly store a large number of identical or similar images separately, thereby reducing the amount of image storage data, reducing the storage space required for image storage, and to a certain extent reducing the storage space required when storing a large number of identical or similar image resources in the project directory.

[0147] Furthermore, to better implement the image storage processing method in the embodiments of this application, based on the image storage processing method, the embodiments of this application also provide a computer device, such as... Figure 9 As shown, it illustrates a structural schematic diagram of the computer device involved in the embodiments of this application, specifically: The computer device may include components such as a processor 901 with one or more processing cores, a memory 902 with one or more computer-readable storage media, a power supply 903, and an input unit 904. Those skilled in the art will understand that... Figure 9 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 901 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 902, and by calling data stored in the memory 902, it performs various functions and processes data, thereby performing overall detection of the computer device. Optionally, the processor 901 may include one or more processing cores; preferably, the processor 901 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 901.

[0148] The memory 902 can be used to store software programs and modules. The processor 901 executes various functional applications and data processing by running the software programs and modules stored in the memory 902. The memory 902 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, video playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 902 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 902 may also include a memory controller to provide the processor 901 with access to the memory 902.

[0149] The computer device also includes a power supply 903 that supplies power to the various components. Preferably, the power supply 903 can be logically connected to the processor 901 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 903 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0150] The computer device may also include an input unit 904, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0151] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 901 in the computer device loads the executable files corresponding to the processes of one or more application programs into the memory 902 according to the following instructions, and the processor 901 runs the application programs stored in the memory 902 to realize various functions, as follows: Obtain a set of similar images to be stored from the set of images to be stored, wherein the set of similar images includes at least two images; By sampling a set of similar images, a sampled image of the set of similar images is obtained; The sampled image is divided into blocks to obtain each image block of the sampled image; The coefficient matrix of each image block is obtained by performing transformation processing on each image block; The coefficient matrix of each image block is compressed and encoded to determine the encoding information of each image block, resulting in an encoded data stream of a set of similar images, wherein the encoded data stream includes the encoding information of each image block; The encoded data stream is stored as a bitmap of a set of similar images.

[0152] For details of each of the above operations, please refer to the previous embodiments, which will not be repeated here.

[0153] Therefore, the computer device of this embodiment can bring the following technical effects: by obtaining a set of similar images to be stored from the set of images to be stored, sampling the set of similar images to obtain a sampled image of the set of similar images; and performing compression encoding processing on the sampled image to obtain an encoded data stream of the set of similar images as a bitmap for storage; wherein after sampling processing of the set of similar images, multiple images in the set of similar images can be sampled into one image for compression encoding processing, thereby compressing and encoding multiple identical or similar images in the set of similar images into one bitmap for storage, without having to repeatedly store a large number of identical or similar images separately, thereby reducing the amount of image storage data, reducing the storage space required for image storage, and to a certain extent reducing the storage space required when storing a large number of identical or similar image resources in the project directory.

[0154] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0155] Therefore, embodiments of this application provide a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the object detection methods provided in the embodiments of this application. For example, the computer program can execute the following steps: Obtain a set of similar images to be stored from the set of images to be stored, wherein the set of similar images includes at least two images; By sampling a set of similar images, a sampled image of the set of similar images is obtained; The sampled image is divided into blocks to obtain each image block of the sampled image; The coefficient matrix of each image block is obtained by performing transformation processing on each image block; The coefficient matrix of each image block is compressed and encoded to determine the encoding information of each image block, resulting in an encoded data stream of a set of similar images, wherein the encoded data stream includes the encoding information of each image block; The encoded data stream is stored as a bitmap of a set of similar images.

[0156] As can be seen, a computer program can be loaded by a processor to execute the steps in any of the image storage processing methods provided in the embodiments of this application. Therefore, the computer-readable storage medium of the embodiments of this application can bring the following technical effects: by obtaining a set of similar images to be stored from the set of images to be stored, sampling processing is performed on the set of similar images to obtain a sampled image of the set of similar images; compression encoding processing is performed on the sampled image to obtain an encoded data stream of the set of similar images as a bitmap of the set of similar images for storage; wherein after sampling processing of the set of similar images, multiple images in the set of similar images can be sampled into one image for compression encoding processing, thereby compressing and encoding multiple identical or similar images in the set of similar images into one bitmap for storage, without having to repeatedly store a large number of identical or similar images separately, thereby reducing the amount of image storage data, reducing the storage space required for image storage, and to a certain extent reducing the storage space required when storing a large number of identical or similar image resources in the project directory.

[0157] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0158] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0159] According to the image storage processing method of this application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.

[0160] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and beneficial effects of the image storage and processing apparatus, computer-readable storage medium, computer equipment and their corresponding units described above can be referred to the description of the image storage and processing method in the above embodiments, and will not be repeated here.

[0161] The foregoing has provided a detailed description of an image storage processing method, apparatus, computer device, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An image storage and processing method, characterized in that, The method includes: Obtain a set of similar images to be stored from the set of images to be stored, wherein the set of similar images includes at least two images; The similar image set is sampled to obtain a sampled image of the similar image set; The sampled image is divided into blocks to obtain each image block of the sampled image; The image blocks are transformed to obtain the coefficient matrix of each image block; The coefficient matrix of each image block is compressed and encoded to determine the encoding information of each image block, thereby obtaining the encoded data stream of the similar image set, wherein the encoded data stream includes the encoding information of each image block; The encoded data stream is stored as a bitmap of the similar image set.

2. The image storage and processing method according to claim 1, characterized in that, The coefficients of each image block include DC coefficients and AC coefficients. The compression encoding process performed on the coefficient matrix of each image block to determine the encoding information of each image block, resulting in the encoded data stream of the similar image set, includes: The DC coefficient is subjected to intermediate encoding processing to obtain the first encoded data of the DC coefficient; The AC coefficients are processed by run-length encoding to obtain the run-length encoded sequence of the AC coefficients; The strings in the run-length encoding sequence are mapped and replaced to obtain the mapping sequence of the run-length encoding sequence and a first hash table, wherein the first hash table is a mapping relationship table between the mapping sequence and the run-length encoding sequence; Based on the mapping sequence and the first hash table, the communication coefficients are subjected to intermediate encoding processing to obtain the second encoded data of the communication coefficients; Entropy coding is performed based on the first encoded data and the second encoded data to determine the encoding information of each image block, thereby obtaining the encoded data stream of the similar image set.

3. The image storage and processing method according to claim 2, characterized in that, The communication coefficients include multiple coefficient values. The entropy coding process based on the first encoded data and the second encoded data to determine the coding information of each image block and obtain the coded data stream of the similar image set includes: The first encoded data is subjected to entropy encoding to obtain the codeword of the DC coefficient; The strings in the coefficient values ​​are mapped and replaced to obtain the mapped values ​​of the coefficient values ​​and a second hash table, wherein the second hash table is a mapping relationship table between the mapped values ​​and the coefficient values; Based on the second hash table and the mapping value, the coefficient values ​​contained in the second encoded data are read and entropy encoding is performed to obtain the codeword of the communication coefficient; The codewords of the DC coefficient and the AC coefficient are concatenated to determine the encoding information of each image block, thereby obtaining the encoded data stream of the similar image set.

4. The image storage and processing method according to claim 1, characterized in that, The step of sampling the set of similar images to obtain sampled images of the set of similar images includes: Obtain the initial color components of each similar image in the similar image set, and the sampling ratio of the similar image set; Based on the sampling ratio, the initial color components of each similar image are sampled to obtain the sampled color components of each similar image; The sampled color components of each similar image are averaged to obtain the sampled image of the similar image set.

5. The image storage and processing method according to claim 1, characterized in that, The step of obtaining the set of similar images to be stored from the set of images to be stored includes: Obtain a set of images to be stored, wherein the set of images to be stored includes at least two images; Obtain the feature information of each image to be stored in the set of images to be stored; Based on the feature information of each image to be stored, similarity clustering is performed on each image in the set of images to be stored to obtain the set of similar images.

6. The image storage and processing method according to claim 5, characterized in that, The step involves clustering the images to be stored in the image set based on their feature information to obtain the similar image set, including: Preliminary feature extraction is performed based on the feature information of each image to be stored to obtain the preliminary features of each image to be stored; Based on the preliminary features of each image to be stored, similarity clustering is performed on each image in the image set to be stored to obtain each clustered image set of the image set to be stored, wherein each clustered image set includes at least two images; Based on the preliminary features of each cluster image in the clustered image set, detailed features are extracted from each cluster image to obtain the detailed features of each cluster image; Based on the detailed features of each clustered image, similarity clustering is performed on each clustered image in the clustered image set to obtain the similar image set.

7. The image storage and processing method according to claim 5, characterized in that, The step involves clustering the images to be stored in the image set based on their feature information to obtain the similar image set, including: Feature extraction is performed based on the feature information of each image to be stored to obtain the image features of each image to be stored; From the unclustered images in the image set to be stored, obtain reference images and cluster them into a newly created category set; Obtain comparison images from the unclustered images in the set of images to be stored; The similarity between the reference image and the comparison image is obtained based on the distance between the image features of the reference image and the image features of the comparison image; If the similarity is greater than a preset similarity threshold, then the compared image is added to the category set; Once the clustering of all images in the set of images to be stored is completed, the set of categories will be used as the set of similar images.

8. An image storage and processing apparatus, characterized in that, The image storage and processing device includes: An acquisition unit is configured to acquire a set of similar images to be stored from a set of images to be stored, wherein the set of similar images includes at least two images; A processing unit is used to perform sampling processing on the set of similar images to obtain a sampled image of the set of similar images; The processing unit is further configured to perform block processing based on the sampled image to obtain each image block of the sampled image; The processing unit is further configured to perform transformation processing on each image block to obtain the coefficient matrix of each image block; The processing unit is further configured to perform compression encoding processing on the coefficient matrix of each image block to determine the encoding information of each image block and obtain the encoded data stream of the similar image set, wherein the encoded data stream includes the encoding information of each image block; A storage unit is used to store the encoded data stream as a bitmap of the similar image set.

9. A computer device, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the image storage processing method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.

11. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the image storage processing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image processing method and device, electronic device and storage medium

    CN114510990A

  • Image compression apparatus, image decoding apparatus, image compression and decoding system, image compression program, and image decoding program

    JP2010219674A