Image compression method, DNA coding method and related devices thereof
By segmenting, replacing and encoding images in DNA information storage, the problem of low storage density in the prior art is solved, and higher storage efficiency and image quality are achieved.
Patent Information
- Application Number
- CN202411560579.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-14
AI Technical Summary
The existing DNA information storage codec algorithm has the problem of low storage density and has failed to effectively utilize the distribution characteristics of the original information.
An image compression method is proposed, by segmenting, extracting, replacing, converting and splicing the pixel matrix of each channel of the image, generating a compressed array and encoding it into a DNA sequence.
Effectively reduces the required storage space, improves storage density, and maintains the visual integrity of the image.
Smart Images

Figure CN119450067A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of DNA information storage technology, and specifically relates to an image compression method, a DNA encoding method and related devices. Background Art
[0002] In the field of DNA information storage, current compression algorithms mostly focus on optimizing the encoded DNA sequence. However, this approach ignores a key point, namely the distribution characteristics of the original information itself.
[0003] Currently, most encoding and decoding algorithms for DNA information storage only implement basic information encoding, and their density limit remains at 2 bits / nt, and this value is subject to the limitations of DNA synthesis technology, that is, the length of the DNA sequence. In practical applications, in order to meet storage requirements, the DNA sequence generated by the file encoding needs to be divided into multiple short segments, and additional index information is attached to ensure the correct recombination and decoding of the sequence. This undoubtedly further reduces the actual storage density of DNA information storage, making it lower than the theoretical 2 bits / nt standard. Summary of the invention
[0004] The present application aims to solve the technical problem of low storage density in the current DNA information storage encoding and decoding algorithm, and provides an image compression method, a DNA encoding method and related devices.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions: In a first aspect, the present application proposes an image compression method, comprising: Perform the following steps for each channel of the image to be compressed: The pixel matrix of a channel is divided into multiple segmentation matrices, the minimum value of each segmentation matrix is obtained, and the matrix composed of the minimum values of each segmentation matrix is recorded as the minimum matrix; Subtracting the minimum value of the corresponding segmentation matrix from all values in the segmentation matrix to obtain a replacement matrix of the pixel matrix; The values in the replacement matrix and the minimum matrix are respectively converted into numbers with different digits in the same base, and a converted replacement matrix and a converted minimum matrix are correspondingly obtained; if the value in the replacement matrix is greater than the maximum value allowed by the corresponding base and digits after conversion, after obtaining the replacement matrix of the pixel matrix, the value greater than the maximum value allowed is replaced by the maximum value allowed; Flatten the replacement matrices after all channel conversions into a one-dimensional array, and then sequentially concatenate the flattened one-dimensional arrays to obtain a first array; The minimum matrix after all channel conversion is flattened into a one-dimensional array, and then the flattened one-dimensional arrays are sequentially concatenated to obtain a second array; the first array and the second array are used as image compression results.
[0006] Furthermore, the size of the segmentation matrix is determined according to storage density and restored image accuracy.
[0007] Furthermore, the step of converting the values in the replacement matrix and the minimum matrix into numbers with different digits in the same base includes: The values in the replacement matrix are converted into four-digit quaternary numbers, and the values in the minimum matrix are converted into two-digit quaternary numbers.
[0008] Furthermore, after obtaining the replacement matrix of the pixel matrix, the method further includes: If the value in the replacement matrix is greater than or equal to 16, it is replaced by 15.
[0009] Furthermore, the flattening into a one-dimensional array includes: Expand horizontally into a one-dimensional array, or expand vertically into a one-dimensional array.
[0010] In a second aspect, the present application proposes an image compression system, comprising: Use the following modules to perform the corresponding steps on each channel of the image: A segmentation module is used to segment a pixel matrix of a channel into multiple segmentation matrices, obtain the minimum value of each segmentation matrix, and record the matrix composed of the minimum values of each segmentation matrix as the minimum matrix; A replacement module, used for subtracting the minimum value of the corresponding segmentation matrix from all values in the segmentation matrix to obtain a replacement matrix of the pixel matrix; a conversion module, used for converting the values in the replacement matrix and the minimum matrix into numbers with different digits in the same base, respectively, and obtaining a converted replacement matrix and a converted minimum matrix accordingly; if the value in the replacement matrix is greater than the maximum value allowed by the corresponding base and digits after conversion, after obtaining the replacement matrix of the pixel matrix, replacing the value greater than the maximum value allowed by the maximum value allowed; A first concatenation module is used to flatten the replacement matrices after all channel conversions into a one-dimensional array, and then sequentially concatenate the flattened one-dimensional arrays to obtain a first array; The second splicing module is used to flatten the minimum matrix after all channel conversions into a one-dimensional array, and then sequentially splice the flattened one-dimensional arrays to obtain a second array; the first array and the second array are used as image compression results.
[0011] In a third aspect, the present application proposes a DNA encoding method, comprising: Compressing an image using the image compression method described in any one of claims 1 to 5; The values in the first array and the second array are respectively encoded into DNA sequences according to base mapping with the DNA sequence.
[0012] In a fourth aspect, the present application proposes a DNA encoding system, comprising: A compression module, used to compress images using the above image compression method; The encoding module is used to encode the values in the first array and the second array into DNA sequences according to the base mapping with the DNA sequence.
[0013] In a fifth aspect, the present application proposes an electronic device, comprising: a memory, and one or more processors; the memory is coupled to the processor; wherein the memory stores computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the steps of the above-mentioned image compression method, or the electronic device executes the steps of the above-mentioned DNA encoding method.
[0014] In a sixth aspect, the present application proposes a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image compression method are implemented, or when the computer program is executed by a processor, the steps of the above-mentioned DNA encoding method are implemented.
[0015] Compared with the prior art, this application has the following beneficial effects: The present application proposes an image compression method, which first divides the pixel matrix of each channel of the image to be compressed, obtains the minimum value of each segmentation matrix to form a minimum matrix, and then subtracts the minimum value of the corresponding segmentation matrix from all values in the segmentation matrix to obtain a replacement matrix. The replacement matrix and the minimum matrix are then converted into numbers with different digits in the same base, flattened, and spliced to complete the compression. The present application utilizes the fact that image information has a certain degree of redundancy and appropriately discards some information, thereby reducing the amount of stored information while maintaining the integrity of the image in terms of naked eye perception. At the same time, the pixel matrix is divided into n segmentation matrices. For each segmentation matrix, 4n are required before processing. 2 The storage space required for bases is 4+2n after segmentation and conversion. 2 Therefore, the present application can effectively reduce the required storage space and increase the storage density.
[0016] The present application also proposes an image compression system, a DNA encoding method, a DNA encoding system, an electronic device and a computer storage medium, which possess all the advantages of the above-mentioned image compression method. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 It is a flowchart of the steps to be executed on each channel of the compressed image in the embodiment of the present application; Figure 2 A schematic diagram of a process of a DNA encoding method for this application; Figure 3 Schematic diagram of the segmentation of pixel matrix A; Figure 4 Schematic diagram of compression ratio for different block lengths; Figure 5 A schematic diagram of a substitution matrix and a minimum matrix; Figure 6 A schematic diagram of an image compression system of the present application; Figure 7 A schematic diagram of the DNA encoding system of the present application. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0020] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0021] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0022] In the description of the embodiments of the present application, it should be noted that if the terms "upper", "lower", "horizontal", "inner", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, or the orientation or position relationship in which the invented product is usually placed when used. It is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0023] With the development of the Internet era, the data generated by humans has exploded. At present, data storage mainly relies on silicon-based storage media such as hard disks and flash memory. However, silicon-based storage media are becoming less and less, and are gradually being consumed as data grows. Therefore, the development of new storage media is an urgent need.
[0024] Thanks to the high density, long-term stability and amplification of DNA, DNA information storage, as a cutting-edge technology, is gradually gaining attention. In DNA information storage systems, encoding and decoding algorithms are the core components responsible for converting conventional digital information into DNA sequences and recovering the original information from these DNA sequences. In the cutting-edge field of DNA information storage, the design of compression algorithms is crucial because the compression algorithm is directly related to how much information can be stored in a limited DNA molecule and the efficiency of information reading. Although DNA has an extremely high storage density, the cost and complexity of synthesizing long strings of DNA sequences are also relatively high. Through compression algorithms, the length of the required DNA sequence can be reduced without sacrificing data integrity, thereby reducing storage costs and increasing read and write speeds. Whether it is words in text, pixels in images, samples in audio, or frames in video, they all present a commonality: there is a high degree of correlation between adjacent elements. In addition, multimedia data (such as images, audio, and video) often contain a large amount of redundant information, which also provides potential space for improving storage efficiency. These redundancies can be appropriately eliminated through intelligent compression strategies, thereby significantly improving the information density of the encoding.
[0025] Traditional compression methods mainly focus on optimizing the encoding of data that has been converted into DNA sequences, such as by reducing repetitive segments in the sequence, using specific DNA sequence patterns to represent more common data blocks, etc. However, this method often does not fully consider the inherent characteristics and distribution patterns of the original information, that is, the text, image, audio or video data before being converted into DNA sequences.
[0026] In most naturally occurring data, there is often a strong correlation between adjacent elements. For example, in text, certain word combinations appear much more frequently than other combinations; in images, the color values of adjacent pixels are often very close, especially in smooth or gradient areas. This correlation means that the data contains a lot of predictability, which makes compression possible. In addition, multimedia data often contains a lot of redundant information. For example, an image may contain large areas of the same color, audio may have long periods of silence or repeated background sounds, and there are often only slight changes between adjacent frames in a video. This redundant information can be reduced by compression algorithms without affecting the overall perceived quality of the data.
[0027] Based on the above situation, the present application proposes an image compression method, a DNA encoding method and related devices, which are described in detail below in conjunction with embodiments and drawings.
[0028] As a first embodiment of an image compression method of the present application, it may include: like Figure 1 As shown in FIG. 1 , it is a flow chart of the steps executed on each channel of the compressed image in this embodiment, specifically: S101, dividing a pixel matrix of a channel into multiple division matrices, obtaining the minimum value of each division matrix, and recording a matrix composed of the minimum values of each division matrix as a minimum matrix.
[0029] For each channel in the image, such as the red channel, green channel, and blue channel in an RGB image, each channel is represented as a two-dimensional pixel matrix, where each element of the matrix represents the color intensity of the image at that location. The pixel matrix of each channel is divided into multiple smaller segmentation matrices. The size of the segmentation will affect the compression ratio and image quality of the image. For each segmentation matrix, find its minimum value, which represents the minimum level of color intensity in the segmentation matrix. And these minimum values are combined into a new matrix, called the minimum matrix.
[0030] S102, subtracting the minimum value of the corresponding segmentation matrix from all values in the segmentation matrix to obtain a replacement matrix of the pixel matrix.
[0031] For each segmentation matrix, subtract the minimum value of the segmentation matrix from each value to obtain a replacement matrix, which can reduce the dynamic range of the data, that is, the difference between the maximum and minimum values of the data, making the data easier to process and compress. Compression algorithms are usually more effective for data with a smaller dynamic range. By preprocessing the data to reduce its range, the performance of the compression algorithm can be improved, thereby achieving a higher compression ratio. In addition, since it is performed independently on each segmentation matrix, the local information of the image can be retained.
[0032] S103, respectively converting the values in the replacement matrix and the minimum matrix into numbers with different digits in the same base, and obtaining a converted replacement matrix and a converted minimum matrix accordingly; if the value in the replacement matrix is greater than the maximum allowable value of the corresponding base and digits after conversion, after obtaining the replacement matrix of the pixel matrix, replacing the value greater than the maximum allowable value with the maximum allowable value.
[0033] By replacing the values in the replacement matrix that are greater than the maximum value allowed for the corresponding base and number of digits after conversion with the maximum value allowed, it can be ensured that all values are within the allowed range during conversion.
[0034] Converting the values in the replacement matrix and the minimum matrix into numbers with the same base but different digits can reduce the representation length of the data, and the compression effect can be optimized by choosing an appropriate base. The base can be determined according to different data characteristics, and the number of digits can be determined according to the range of values and the required accuracy. By choosing an appropriate base and number of digits, data can be represented more efficiently while reducing the number of bits required for storage and transmission.
[0035] S104, flattening the replacement matrices after all channel conversions into a one-dimensional array, and then sequentially concatenating the flattened one-dimensional arrays to obtain a first array.
[0036] S105, flattening the minimum matrix after all channel conversion into a one-dimensional array, and then sequentially splicing the flattened one-dimensional arrays to obtain a second array; the first array and the second array are used as image compression results.
[0037] Flattening a matrix means converting a two-dimensional matrix into a one-dimensional array, usually in row-major or column-major order. For row-major, for example, each row of the matrix is concatenated in turn to form a one-dimensional array. After flattening the matrix for each channel into a one-dimensional array, the next step is to concatenate these one-dimensional arrays. The order of concatenation is usually the same as the order in which the channels are processed, for example, the red channel is processed first, then the green channel, and finally the blue channel. If each channel gets a one-dimensional array, then the first array after concatenation will be a consecutive arrangement of the three one-dimensional arrays.
[0038] It is worth noting that most of the existing DNA information storage compression and decoding algorithms are lossless, aiming to completely retain all information in the DNA carrier. When encoding images, the existing technology does not distinguish between other types of files, which makes it impossible to use some of the unique characteristics of images for personalized processing. However, for specific information sources such as image data, its inherent structure contains redundant space that can be utilized. At the same time, it has been found that the existence of small differences between adjacent pixels in the image provides a possibility for improving information storage efficiency.
[0039] Based on the above findings, this application has designed an image lossy compression codec algorithm specifically for DNA information storage. This algorithm takes into account the characteristics of image pixel distribution, and through selective information discarding, it achieves the goal of significantly improving the coding density while ensuring the visual effect of the image. This application makes full use of the neighboring similarity of pixel values in the image, and through fine splitting of the pixel matrix and reasonable elimination of redundant information, it successfully achieves a significant increase in coding density, thereby significantly improving the efficiency of DNA storage.
[0040] It should be noted that the above-mentioned image compression, in addition to being used for DNA storage, has a wide range of application scenarios, such as monitoring, artificial intelligence training and learning, image processing software, servers and network transmission, etc., all of which may design image compression methods, and may also adopt the above-mentioned image compression method of this application.
[0041] The following is an example of applying to DNA storage to further illustrate the image compression method of the present application: like Figure 2 As shown, it is a schematic diagram of a process of a DNA encoding method of the present application, which may include: S201, extract the compressed image by channel to obtain a pixel matrix A for each channel.
[0042] In some embodiments of the present application, the image to be compressed is an RGB image with 3 channels, so the subsequent operations are performed on the 3 channels respectively. The present application can be applied to the compression of various images, as well as the corresponding subsequent encoding and storage, such as grayscale images with 1 channel, so this type of image does not need to extract channels, and the pixels of the original image are the pixel matrix. Another example is a four-channel color image.
[0043] S202, segmenting the pixel matrix A.
[0044] For each pixel matrix A extracted from the image to be compressed, it needs to be segmented. Assume that the size of the pixel matrix A is , the size of the segmentation matrix obtained by segmentation is .like Figure 3 As shown, it is a schematic diagram of the segmentation of the pixel matrix A. In this step, is any positive integer less than a and less than b. The size of will affect the storage density and the accuracy of the decoded image. The smaller the value, the more values need to be stored, the lower the storage density, and the higher the accuracy of the restored image. The larger the value is, the fewer values need to be stored, the higher the storage density is, and the lower the accuracy of the restored image is. From the perspective of storage density, The smaller the value of is, the more matrices there are after segmentation, and each matrix contains fewer pixels, which can record the local features of the image more finely. However, more matrix information needs to be stored, resulting in low storage density. The larger the value of is, the fewer matrices are after segmentation, and each matrix contains more pixels. Therefore, less information needs to be stored overall, and the storage density is high. However, a larger matrix may not be able to accurately represent the local features of the image, resulting in information loss. Figure 4 The figure shows the compression ratio of different block lengths.
[0045] In practical applications, there may be or Cannot be In the case of integer division, the size will be insufficient There is no need to fill in the size of the matrix, just keep the actual size.
[0046] S203, obtaining the minimum matrix B.
[0047] For all segmentation matrices obtained by segmenting a pixel matrix A, select the minimum value V min , this minimum value represents the lowest level of pixel values in the segmentation matrix and is recorded. min Together they form the minimum matrix B, and their positions are the same as the corresponding partition matrices in matrix A, which means that if matrix A is partitioned in row and column order, then the minimum matrix B should also arrange these minimum values in the same row and column order.
[0048] S204, update the values in the pixel matrix A to obtain a replacement matrix of the pixel matrix A.
[0049] For each minimum matrix B, subtract the minimum value V in this minimum matrix B from each value in it min , and update the obtained difference at the corresponding position of the pixel matrix A to obtain a replacement matrix. In this embodiment, in order to ensure that all values in the updated replacement matrix can be represented by two base bits, each value is required to be less than 16. When the obtained difference is greater than or equal to 16, it can be replaced with 15. It should be noted that the requirement in this embodiment that each value is less than 16 is because in this example, all values are subsequently converted to quaternary numbers. In other embodiments of the present application, if conversion to other base numbers is required later, the corresponding requirements in this step can also be adaptively adjusted. Figure 5 As shown, it is a schematic diagram of the replacement matrix and the minimum matrix, where the minimum value V min =189.
[0050] S205, converting the numerical value into a quaternary number of equal length.
[0051] For pixel matrix A, each value has been controlled within 16 through the above steps, so each value can be converted into a two-digit quaternary number. For the minimum matrix B, the elements are the original image pixel values, so the maximum value is 255, and each element can be converted into a four-digit quaternary number. It should be noted that quaternary numbers use 0, 1, 2, and 3 as digits, so the range that a two-digit quaternary number can represent is 00 to 33 (equivalent to 0 to 15 in decimal). The maximum value that a four-digit quaternary number can represent is 3333 (255 in decimal), which corresponds exactly to the maximum value of an 8-bit image pixel value.
[0052] In practice, to convert a decimal number to quaternary, you can keep dividing the number by 4 and record the remainder. However, for the values in the smallest matrix B, since they may reach 255, you need to ensure that the converted quaternary number has four digits.
[0053] S206, expanding the converted replacement matrix and the minimum matrix into a one-dimensional array.
[0054] The converted replacement matrix and minimum matrix are expanded into one-dimensional arrays respectively. The expansion can be done horizontally or vertically, or other rules can be used.
[0055] In practical applications, when the width of the image is fixed and the subsequent processing steps need to access pixels by row, you can use horizontal expansion to arrange the elements in the matrix into a one-dimensional array in row order, that is, read all the elements of the first row first, then read all the elements of the second row, and so on. When the height of the image is fixed and the subsequent processing steps need to access pixels by column, you can use vertical expansion to read all the elements of the first column first, then read all the elements of the second column, and so on. In addition to horizontal expansion and vertical expansion, you can also use zigzag expansion, block expansion, and even custom rules.
[0056] S207, encoding the expanded one-dimensional array into a DNA sequence.
[0057] Since the one-dimensional array is composed of quaternary numbers, the array can be converted into a DNA sequence according to the prescribed mapping relationship between 0, 1, 2, 3 and A, T, C, G.
[0058] It should be noted that quaternary numbers use the four digits 0, 1, 2, and 3 to represent values. The four bases in DNA are adenine (A), thymine (T), cytosine (C), and guanine (G). According to the mapping relationship, the quaternary numbers 0, 1, 2, and 3 correspond to the DNA bases A, T, C, and G, respectively. This mapping relationship is based on the analogy between biological DNA sequences and digital systems.
[0059] This application proposes a new image lossy processing compression algorithm for the field of DNA information storage, which can effectively reduce the amount of information that needs to be stored, but has no obvious difference in the final effect. In addition, the pixel matrix is modularized and the pixel values are split, which reduces the information that needs to be recorded.
[0060] Correspondingly, such as Figure 6 FIG. 1 is a schematic diagram of an image compression system of the present application, which may include: Use the following modules to perform the corresponding steps on each channel of the image: A segmentation module is used to segment a pixel matrix of a channel into multiple segmentation matrices, obtain the minimum value of each segmentation matrix, and record the matrix composed of the minimum values of each segmentation matrix as the minimum matrix; A replacement module, used for subtracting the minimum value of the corresponding segmentation matrix from all values in the segmentation matrix to obtain a replacement matrix of the pixel matrix; a conversion module, used for converting the values in the replacement matrix and the minimum matrix into numbers with different digits in the same base, respectively, and obtaining a converted replacement matrix and a converted minimum matrix accordingly; if the value in the replacement matrix is greater than the maximum value allowed by the corresponding base and digits after conversion, after obtaining the replacement matrix of the pixel matrix, replacing the value greater than the maximum value allowed by the maximum value allowed; A first concatenation module is used to flatten the replacement matrices after all channel conversions into a one-dimensional array, and then sequentially concatenate the flattened one-dimensional arrays to obtain a first array; The second splicing module is used to flatten the minimum matrix after all channel conversions into a one-dimensional array, and then sequentially splice the flattened one-dimensional arrays to obtain a second array; the first array and the second array are used as image compression results.
[0061] In some embodiments of the image compression system of the present application, the size of the segmentation matrix can be determined according to the storage density and the accuracy of the restored image.
[0062] In some embodiments of the image compression system of the present application, when converting the values in the replacement matrix and the minimum matrix into numbers with different digits in the same base, the values in the replacement matrix can be converted into four-digit quaternary numbers, and the values in the minimum matrix can be converted into two-digit quaternary numbers.
[0063] In some embodiments of the image compression system of the present application, after obtaining the replacement matrix of the pixel matrix, the method may further include: if the value in the replacement matrix is greater than or equal to 16, replacing it with 15.
[0064] In some embodiments of the image compression system of the present application, when flattening into a one-dimensional array, it can be expanded horizontally into a one-dimensional array, or expanded vertically into a one-dimensional array.
[0065] In addition, if Figure 7 As shown, it is a schematic diagram of the DNA encoding system of the present application, which may include: A compression module, used to compress the image using the above-mentioned image compression method; The encoding module is used to encode the values in the first array and the second array into DNA sequences according to the base mapping with the DNA sequence.
[0066] It should be noted that in the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of each module is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another device, or some features can be ignored or not executed. The module described as a separate component may or may not be physically separated. The component displayed as a module may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed in multiple different places. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0067] In addition, each module in each embodiment of the present invention may be integrated into a processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0068] An embodiment of the present application also provides an electronic device, which may include one or more processors, a memory, and a communication interface.
[0069] The memory, the communication interface and the processor are coupled, for example, the memory, the communication interface and the processor may be coupled together via a bus.
[0070] The communication interface is used for data transmission with other devices. The memory stores computer program code. The computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the steps of the above-mentioned image compression method, or the electronic device executes the steps of the above-mentioned DNA encoding method.
[0071] Wherein, the processor can be a processor or a controller, for example, a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the present disclosure. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessors, and the like. The processor can be used to support electronic devices to execute the method steps provided in the above embodiments.
[0072] The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The above bus may be divided into an address bus, a data bus, a control bus, etc.
[0073] An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image compression method are implemented, or when the computer program is executed by a processor, the steps of the above-mentioned DNA encoding method are implemented.
[0074] The computer-readable storage medium involved in the present application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.
[0075] For the description of the relevant parts of the image compression system, DNA encoding method, DNA encoding system, electronic device and computer-readable storage medium provided in the embodiments of the present application, please refer to the detailed description of the corresponding parts in the image compression method provided in the embodiments of the present application, which will not be repeated here. In addition, the parts of the above technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.
[0076] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An image compression method, characterized in that: include: Perform the following steps for each channel of the image to be compressed: The pixel matrix of a channel is divided into multiple segmentation matrices, the minimum value of each segmentation matrix is obtained, and the matrix composed of the minimum values of each segmentation matrix is recorded as the minimum matrix; Subtracting the minimum value of the corresponding segmentation matrix from all values in the segmentation matrix to obtain a replacement matrix of the pixel matrix; The values in the replacement matrix and the minimum matrix are respectively converted into numbers with different digits in the same base, and a converted replacement matrix and a converted minimum matrix are correspondingly obtained; if the value in the replacement matrix is greater than the maximum value allowed by the corresponding base and digits after conversion, after obtaining the replacement matrix of the pixel matrix, the value greater than the maximum value allowed is replaced by the maximum value allowed; Flatten the replacement matrices after all channel conversions into a one-dimensional array, and then sequentially concatenate the flattened one-dimensional arrays to obtain a first array; The minimum matrix after all channel conversion is flattened into a one-dimensional array, and then the flattened one-dimensional arrays are sequentially concatenated to obtain a second array; the first array and the second array are used as image compression results.
2. The image compression method according to claim 1, characterized in that: The size of the segmentation matrix is determined according to the storage density and the accuracy of the restored image.
3. An image compression method according to claim 1 or 2, characterized in that: The step of converting the values in the replacement matrix and the minimum matrix into numbers with different digits in the same base comprises: The values in the replacement matrix are converted into four-digit quaternary numbers, and the values in the minimum matrix are converted into two-digit quaternary numbers.
4. The image compression method according to claim 3, characterized in that: After obtaining the replacement matrix of the pixel matrix, the method further includes: If the value in the replacement matrix is greater than or equal to 16, it is replaced by 15.
5. An image compression method according to claim 4, characterized in that: The flattening is a one-dimensional array, including: Expand horizontally into a one-dimensional array, or expand vertically into a one-dimensional array.
6. An image compression system, characterized in that: include: Use the following modules to perform the corresponding steps on each channel of the image: A segmentation module is used to segment a pixel matrix of a channel into multiple segmentation matrices, obtain the minimum value of each segmentation matrix, and record the matrix composed of the minimum values of each segmentation matrix as the minimum matrix; A replacement module, used for subtracting the minimum value of the corresponding segmentation matrix from all values in the segmentation matrix to obtain a replacement matrix of the pixel matrix; A conversion module, used for converting the values in the replacement matrix and the minimum matrix into numbers with different digits in the same base, respectively, to obtain a converted replacement matrix and a converted minimum matrix; If the value in the replacement matrix is greater than the maximum value allowed by the corresponding base and number of bits after conversion, after obtaining the replacement matrix of the pixel matrix, the value greater than the maximum value allowed is replaced by the maximum value allowed; A first concatenation module is used to flatten the replacement matrices after all channel conversions into a one-dimensional array, and then sequentially concatenate the flattened one-dimensional arrays to obtain a first array; The second splicing module is used to flatten the minimum matrix after all channel conversions into a one-dimensional array, and then sequentially splice the flattened one-dimensional arrays to obtain a second array; the first array and the second array are used as image compression results.
7. A DNA encoding method, characterized in that: include: Compressing an image using the image compression method described in any one of claims 1 to 5; The values in the first array and the second array are respectively encoded into DNA sequences according to base mapping with the DNA sequence.
8. A DNA encoding system, characterized in that: include: A compression module, used to compress an image using the image compression method according to any one of claims 1 to 5; The encoding module is used to encode the values in the first array and the second array into DNA sequences according to the base mapping with the DNA sequence.
9. An electronic device, characterized in that: include: A memory and one or more processors; the memory is coupled to the processor; wherein the memory stores computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the steps of the image compression method as described in any one of claims 1 to 5, or the electronic device executes the steps of the DNA encoding method as described in claim 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the image compression method as described in any one of claims 1 to 5, or, when executed by a processor, implements the steps of the DNA encoding method as described in claim 7.
Citation Information
Patent Citations
16*4-level reference frame compression method and device
CN110933442A
Image data DNA storage method and system, electronic equipment and storage medium
CN116258781A
Improved shallow compression standard prediction information coding algorithm
CN118400536A
Compression device, compression method, and compression program
WO2020203191A1
DNA storage cascade encoding and decoding methods for type-1 and type-2 segmented error correction internal codes
WO2023130676A1