[go: up one dir, main page]

CN111405294B - Storage and transmission method of image raster data - Google Patents

Storage and transmission method of image raster data Download PDF

Info

Publication number
CN111405294B
CN111405294B CN202010216168.1A CN202010216168A CN111405294B CN 111405294 B CN111405294 B CN 111405294B CN 202010216168 A CN202010216168 A CN 202010216168A CN 111405294 B CN111405294 B CN 111405294B
Authority
CN
China
Prior art keywords
channel component
value
component value
values
pixels
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010216168.1A
Other languages
Chinese (zh)
Other versions
CN111405294A (en
Inventor
张征
王凯
闫富松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ludong University
Original Assignee
Ludong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ludong University filed Critical Ludong University
Priority to CN202010216168.1A priority Critical patent/CN111405294B/en
Publication of CN111405294A publication Critical patent/CN111405294A/en
Application granted granted Critical
Publication of CN111405294B publication Critical patent/CN111405294B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/119Adaptive subdivision aspects, e.g. subdivision of a picture into rectangular or non-rectangular coding blocks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

本发明公开了一种图像栅格数据的存储及传输方法,通过将图像栅格数据分割为多个固定尺寸的矩形块,对矩形块内各通道分量数值按照重复次数进行排序获得通道分量数值列表,在满足准确度r的前提下,舍弃通道分量数值列表中占比较少的数值,以通道分量数值在通道分量数值列表中的位置信息代替通道分量数值本身进行图像栅格数据的压缩存储。由此,本发明的图像栅格数据的存储及传输方法可以在确保准确度r的前提下降低图像栅格数据的存储空间,方法简单,执行效率高,可以实现分布式处理,特别适用于对大规模栅格数据进行压缩处理。

Figure 202010216168

The invention discloses a method for storing and transmitting image grid data. By dividing the image grid data into a plurality of rectangular blocks of fixed size, the value of each channel component in the rectangular block is sorted according to the number of repetitions to obtain a list of channel component values. , on the premise of satisfying the accuracy r, discard the values with a small proportion in the channel component value list, and use the position information of the channel component values in the channel component value list instead of the channel component value itself to compress and store the image raster data. Therefore, the image grid data storage and transmission method of the present invention can reduce the storage space of the image grid data on the premise of ensuring the accuracy r, the method is simple, the execution efficiency is high, and distributed processing can be realized, and is especially suitable for Compress large-scale raster data.

Figure 202010216168

Description

Storage and transmission method of image raster data
Technical Field
The invention relates to the technical field of image raster data storage and transmission, in particular to a method for storing and transmitting image raster data.
Background
The grid data is a data organization manner in which spatial ground features or phenomena are represented in the form of a two-dimensional matrix, each matrix cell is referred to as a grid cell or pixel, and each data of the grid cell represents attribute data of the ground features or phenomena. The raster image data generally includes a plurality of channels, usually RGB or RGBA, R representing the R channel and recording the red information in the picture, G representing the G channel and recording the green information in the picture, B representing the B channel and recording the blue information in the picture, a representing the a channel and recording the transparency information of the picture; typically each color component is represented by a one byte of type of agent 8, with values ranging from integer 0 to integer 255, as is the case with color component R, G, B, A, and various combinations of color components R, G, B can represent up to 1677 ten thousand colors, based on the principle of three primary colors.
The image raster data exists in a large amount in real life, such as common picture files in the format of bmp, png, etc. with 24 bit depth or 32 bit depth, where 24 bit depth represents a color picture containing RGB three-channel information, and 32 bit depth represents a color picture containing RGBA four-channel information. The current day with a large amount of raster image data is produced, which results in a large amount of storage space and network transmission requirements.
At present, there are many compression techniques for image data files, and the commonly used image storage techniques mainly include lossless compression and lossy compression. Lossless compression technology mainly comprises file formats such as tif and png, and generally, the file formats need larger storage space and low compression rate; the lossy compression generally uses a JPEG lossy compression image standard format, which has a better compression rate and reduces the storage space, but cannot ensure the accuracy of the image, and the image has distortion.
Therefore, it is a continuing research topic for those skilled in the art to further compress the storage space of the raster image data while ensuring the image to meet the required fidelity.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: a method for storing and transmitting raster image data is provided.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
a method for storing and transmitting image raster data comprises the following steps:
s1, obtaining image grid source data, wherein the image grid source data is composed of a plurality of channel components;
s2, segmenting the image grid source data, and segmenting the image grid source data into a plurality of rectangular blocks with preset fixed sizes; the portion of less than one rectangular block is filled with 0.
S3, performing the following compression processing on the rectangular blocks obtained in step S2 one by one;
s3-1, counting the distribution of each channel component value of all pixels in the rectangular block, and sorting according to the number of times of repeated value to form a channel component value list;
s3-2, storing the whole or partial distribution condition of each channel component value in the rectangular block;
s3-3, replacing the channel component value itself with the position information of the channel component value in the channel component value list, and storing, wherein the storage space required by the position information of the channel component value in the channel component value list is less than the storage space required by the channel component value itself; or directly storing the channel component values themselves;
s4, storing and transmitting the image raster data after the compression processing;
s5, the image raster data is decompressed and restored in the reverse order of steps S1-S3.
Compared with the prior art, the invention has the following technical effects: compared with the existing lossless compression files in the lossless TIFF format and the png format, the lossless compression file has the advantages of smaller occupied storage space, simple processing method and high execution efficiency. The image grid result data obtained by the processing of the method can also continue to use the existing various lossless image compression technologies, thereby obtaining better compression effect.
On the basis of the technical scheme, the invention can be further improved as follows.
Preferably, in step S1, the method further includes a step of presetting accuracy r, where 0< r < 1; the accuracy r is defined as follows: assuming that a certain image grid source data is a grid picture with m rows and n columns, that is, there are m × n pixels in total, and the type of each pixel is RGB or RGBA, if the source image is subjected to storage processing, the resulting grid data has y pixels with the same value as the pixel value of the source image, and then y/(m × n) × 100% is defined as the accuracy of the image data. For example: the image grid source data has 1000000 pixels, 900000 of which have the same pixel value after storage processing, and the remaining 100000 pixel values have errors during storage processing, so that the accuracy r of the image data obtained by processing by the storage method is 90%.
The step S3-2 further includes the following determination steps:
s3-2-1, judging whether the number of the numerical values in the channel component numerical value list is more than 2xIf yes, executing the step S3-2-2, otherwise executing the step S3-2-5; wherein x is a positive integer less than 8;
s3-2-2, judging the first 2 of the channel component value in the rectangular block in the channel component value listxWhether the ratio of the number of pixels to the total pixels contained in the rectangular block is greater than a preset accuracy r or not is judged, if yes, the step S3-2-3 is executed, and if not, the step S3-2-4 is executed;
s3-2-3, setting the channel component value distribution identification as a second identification value which is 2x-1 byte space storing the first 2 in the channel component value listx-1 value, storing the 2 nd value in the list of channel component values in 1 bytexValue or channel component value list 2xThe average of the value and all subsequent values; jumping to step S3-3;
s3-2-4, setting a channel component numerical value distribution identifier as a third identifier value, and storing all pixel data in an image grid source data format; jumping to step S4;
s3-2-5, setting the channel component value distribution identifier as a first identifier value, and using the identifier as 2xStoring all values in channel component value list in 1 byte space, less than 2xThe part is filled up with 0, and the process goes to step S3-3.
The beneficial effect of adopting the further scheme is that: compared with the existing lossy compression method, the accuracy of the image data can be accurately controlled.
Preferably, in step S3-3, different steps are performed according to different channel component value distribution identifiers:
if the channel component numerical value distribution identifier is the first identifier value, replacing the channel component numerical value per se by the position information of the channel component numerical value in the channel component numerical value list, and storing the channel component numerical value;
if the channel component numerical value distribution identifier is the second identifier value, replacing the channel component numerical value itself with the position information of the channel component numerical value in the channel component numerical value list for the channel component numerical value stored in the channel component numerical value list; for channel component values not stored in the list of channel component values, the value is given a value of "2x-1 "this particular value replaces the channel component value itself; the position information value is counted from '0', the position of the last value in the channel component value list is 2x-1, and the position information value exactly corresponds to x storage spaces.
And if the channel component numerical value distribution identifier is a third identifier value, storing the channel component numerical value distribution identifier in an original storage mode of the image grid source data.
Preferably, the channel component value distribution identification is stored in 1 byte.
The beneficial effect of adopting the further scheme is that: the data format is uniform, and the program processing is convenient.
Preferably, the longest edge of the rectangular block takes an integer value between 10 and 30.
The beneficial effect of adopting the further scheme is that: the method can reduce the number of channel component values in a single rectangular block with high probability, and cannot lead to excessive segmentation to result in additional stored information, thereby achieving better balance in the aspects of image compression rate and processing speed.
Preferably, said x ═ 4;
the beneficial effect of adopting the further scheme is that: the image compression rate and the processing speed can be well balanced.
Preferably, the plurality of rectangular blocks cut in step S2 are allocated to a plurality of terminals for distributed synchronization processing.
The beneficial effect of adopting the further scheme is that: through distributed synchronous processing, the processing efficiency of massive image data can be greatly improved.
Drawings
FIG. 1 is a flow chart of a method for storing and transmitting raster image data according to the present invention;
FIG. 2 is a flowchart illustrating the detailed steps of step S3 according to the present invention;
FIG. 3 is a flowchart illustrating the detailed steps of step S3-2 according to the present invention.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1-3, the method for storing and transmitting raster image data includes the following steps:
a method for storing and transmitting image raster data comprises the following steps:
s1, obtaining image grid source data, wherein the image grid source data consists of RGB three channel components; the preset accuracy r is 0.9;
s2, dividing the image grid source data into a plurality of rectangular blocks with the size of 20 multiplied by 20; the portion of less than one rectangular block is filled with 0.
S3, performing the following compression processing on the rectangular blocks obtained in step S2 one by one;
s3-1, counting the distribution of each channel component value of all pixels in the rectangular block, and sorting according to the number of times of repeated value to form a channel component value list;
s3-2, storing the distribution of all or part of the values of the channel components in the rectangular block, specifically,
s3-2-1, judging whether the number of the numerical values in the channel component numerical value list is more than 24If yes, executing step S3-2-2, otherwise executing step S3-2-5;
s3-2-2, judging whether the ratio of the number of the first 16 pixels of the channel component numerical value in the channel component numerical value list to the total pixels contained in the rectangular block is larger than a preset accuracy r or not, if so, executing a step S3-2-3, otherwise, executing a step S3-2-4;
s3-2-3, setting the channel component numerical value distribution identifier as '2', storing the first 15 values in the channel component numerical value list in 15 1-byte spaces, and storing the 16 th value in the channel component numerical value list or the average value of the 16 th value and all subsequent values in the channel component numerical value list in 1 byte; jumping to step S3-3;
s3-2-4, setting the channel component value distribution identifier as '3', and storing all pixel data in an image grid source data format; jumping to step S4;
s3-2-5, setting the channel component value distribution mark as '1', storing all values in the channel component value list by 16 1-byte spaces, supplementing less than 16 parts by 0, and jumping to the step S3-3.
S3-3, replacing the channel component value itself with the position information of the channel component value in the channel component value list, and storing, wherein the position information of the channel component value in the channel component value list is stored in 4bit space, and the channel component value itself is stored in 8bit space; or directly storing the channel component values themselves; specifically, different steps are executed according to different channel component value distribution identifiers:
if the channel component numerical value distribution identifier is '1', the numerical value of each channel corresponding to each pixel already exists in the channel component numerical value list, and the position information of the channel component numerical value in the channel component numerical value list is used for replacing the channel component numerical value per se and storing the channel component numerical value;
if the channel component numerical value distribution identifier is '2', replacing the channel component numerical value itself by the position information of the channel component numerical value in the channel component numerical value list for the channel component numerical value stored in the channel component numerical value list; for channel component values not stored in the list of channel component values, replacing the channel component value with "15", note that since the position in the list of channel component values starts from "0", here "15" is actually the 16 th data position in the list of channel component values;
and if the channel component numerical value distribution is marked as '3', storing the channel component numerical value distribution according to the original storage mode of the image grid source data.
S4, storing and transmitting the image raster data after the compression processing;
s5, the image raster data is decompressed and restored in the reverse order of steps S1-S3.
According to the above steps, the following are further explained:
assume that the image grid source Data obtained in step S1 is composed of K rows and L columns, each pixel is represented by RGB color of 24 bits, R, G, B of each pixel needs 1 byte for storage, and therefore, 3 bytes of storage space is needed for one pixel. First, the memory layout of all pixels of the image grid source data is shown in table 1 (the column and row numbers described below refer to starting from 1):
D(1,1) D(1,2 D(1,3) D(1,4) D(1,5) D(1,L-1) D(1,L)
D(2,1) D(2,2) D(2,3) D(2,4) D(2,5) D(2,L-1) D(2,L)
D(3,1) D(3,2) D(3,3) D(3,4) D(3,5) D(3,L-1) D(3,L)
D(K,1) D(K,2) D(K,3) D(K,4) D(K,5) D(K,L-1) D(K,L)
TABLE 1
In table 1, D (1, 1) represents a pixel value in row 1 and column 1, and is an integer value of 3 uint8 types, which corresponds to an R-channel component value, a G-channel component value, and a B-channel component value of the pixel, respectively; d (K, L-1) represents the pixel value of the K row at column L-1, and so on.
In step S2, the image grid source data is divided into regions. The division unit is a rectangular block composed of a rows and b columns of pixels. The raster data of K rows and L columns in table 1 is divided into rectangular blocks of s rows and t columns in units of rectangular blocks of a rows and B columns, and if the number of the rectangular blocks divided into the last row (or column) is less than that of the rectangular blocks in the a rows (or B columns), the supplementary channel component value R is 0, G is 0, and B is 0. Wherein, when K is an integer multiple of a, s is K/a, otherwise s is [ K/a ] + 1; when L is an integer multiple of b, t is L/b, otherwise t is [ L/b ] + 1;
the physical meaning of dividing the rectangular blocks is that the types of pixel color values of most images in the local area are limited, and the smaller the local area is, the less the types of colors are generally: for the whole image raster source Data, the colors of its pixels are very many, specifically reflected to R, G, B color components, the channel component values are distributed on the values of 0 to 255, and each color component can have 256 values at most. However, in many images, the color types of the local area are often much less, and specifically correspond to R, G, B color components, for example, in a rectangular block area (400 pixels in total) composed of 20 rows and 20 columns, the value of the R color component may only have 12 different integer values, the value of the G color component may only have 16 different integer values, and the value of the B color component may only have 11 different integer values. Then, when the pixels in the rectangular area are stored, it is completely unnecessary to use the conventional method of using 1 byte per color component R (or G, or B), and less memory may be used to store the specific value of each color component, for example, if the R values of all the pixels in the rectangular space are less than 16, 4 bits may be used to refer to the R value of each pixel in the rectangular block, because the 4-bit storage space is sufficient to store 16 different integer values, only one mapping relationship between the 4-bit space and the specific R value needs to be established.
In step S3, after the image grid source data in table 1 is subjected to region division according to step 2 to obtain S × t rectangular blocks, the compression processing is performed on the rectangular blocks one by one, and the processing mode of each rectangular block is completely the same. Taking the first rectangular block Rect (s is 1, t is 1) (composed of a row and a column of pixels), the memory layout of the pixels is shown in table 2 below:
D(1,1) D(1,2 D(1,3) D(1,4) D(1,5) D(1,b-1) D(1,b)
D(2,1) D(2,2) D(2,3) D(2,4) D(2,5) D(2,b-1) D(2,b)
D(3,1) D(3,2) D(3,3) D(3,4) D(3,5) D(3,b-1) D(3,b)
D(a,1) D(a,2) D(a,3) D(a,4) D(a,5) D(a,b-1) D(a,b)
TABLE 2
In table 2, D (1, 1) indicates a pixel value in row 1 and column 1 in the rectangular block, and is an integer value of 3 uint8 types, which corresponds to the R channel component value RValue, G channel component value GValue, and B channel component value BValue of the pixel, respectively; d (a, b) represents the pixel value of row a, column b, and so on.
RValue, GValue, BValue values are integers 0 to 255, the same processing method is applied to each channel component value, and only the color component R is described as follows:
the method comprises the following steps: and counting the value distribution of the R values of the color components of the pixels of the rectangular block, and arranging the R values from multiple to few according to the repetition times of the channel component values, wherein the repetition times of the channel component values are the number of the pixels taking the values in the rectangular block, and the number of the pixels can be the same.
For example, the statistical results of the distribution of the RValue values of the pixels of the rectangular block in table 2 are as follows:
the number of pixels of RVvalue 120 is 115 in total;
the number of pixels of RVvalue 121 is 102;
the number of pixels of RVvalue 122 is 102;
the number of pixels of RVvalue 126 is 30;
the number of pixels of RVvalue 127 is 22;
the number of pixels of RVvalue 68 is 10 in total;
the number of pixels of RVvalue 69 is 3 in total;
...
the number of pixels of RVvalue 26 is 1 in total;
the number of pixels may be the same, for example, the same for the R-channel component values 121 and 122.
Step two: storing distribution information of R values of pixel color components of the rectangular block, the distribution information including: r-channel component value distribution identification (1-byte unsigned integer), R-channel component value list (16 1-byte unsigned integers or null).
According to the statistical result of the step one, the following three conditions are divided:
the first condition is as follows: the number of RValue taking different values in the statistical result is not more than 16, 17 bytes of storage space are needed, wherein 1 byte stores the R channel component value distribution identification and is set to be 1, and the other 16 bytes store the R channel component value list.
In this case, the content of the distribution information is as follows:
Figure BDA0002424489320000101
TABLE 3
In this case, the pixel color values of the image in the local area are less than 16 in type, so 4 bits can be used to represent the position of the R channel component value in the R channel component value list instead of the 8-bit R channel component value itself.
The R channel component value list records the value taking condition of the pixel RValue of the rectangular block, and 16 unsigned integer values with 1 byte are exactly matched and mapped with a storage space of 4 bits. As shown in table 3, assuming that Rvalue of a pixel in the tile in the raster source data is 120, and the serial number of the tile corresponding to 120 in the R-channel component value list is 0, the value of "120" is replaced by the position information "0" of 120 in the R-channel component value list. The space is only 4 bits for 0-15, and 8 bits for 0-256, so that the space can be saved.
Case two: in the statistical result, RValue takes different values, the number of the different values is more than 16, the proportion of the pixels of the first 15 types with the largest number of pixels arranged in sequence in the rectangular block pixels is not less than the accuracy R value of the given image data, the R channel component value distribution identifier is set to be 2, and 17 bytes of storage space are needed.
For example, the statistical result of the distribution of the R values of the color components of the pixels of the rectangular block in table 2 is as follows:
the number of pixels of RVvalue 120 is 115 in total;
the number of pixels of RVvalue 121 is 102;
the number of pixels of RVvalue 122 is 72;
the number of pixels of RVvalue 126 is 30;
the number of pixels of RVvalue 127 is 22;
the number of pixels of RVvalue 68 is 10 in total;
the number of pixels of RVvalue 69 is 3 in total;
the number of pixels of RVvalue 26 is 1 in total;
the number of pixels of RVvalue 96 is 1 in total;
the number of pixels of RVvalue 36 is 1 in total;
the number of pixels of RVvalue 46 is 1 in total;
the number of pixels of RVvalue 16 is 1 in total;
the number of pixels of RValue 146 is 1 in total;
the number of pixels of RVvalue 111 is 1 in total;
the number of pixels of RVvalue 55 is 1;
the number of pixels of RVvalue 66 is 1 in total;
the number of pixels of RValue 77 is 1;
……
in this case, the ratio of the top 15 pixels, which have the largest number of pixels arranged in order, to the pixels of the rectangular block is (115+102+72+30+22+10+3+1+1+1+1+1+ 1)/(20x20) is 90.5%, and the R value of the pixel R channel component of the rectangular block is 90% because the accuracy R value of the set image data is 90%. The physical meaning of this case is: although the types of pixel color values of the image in the local area are more, the values of the pixel color components are relatively gathered and distributed in the main 15 types of R channel component values, and only a small number of pixels are dispersed in other values.
In this case, the content of the distribution information is as follows:
Figure BDA0002424489320000111
TABLE 4
The last R channel component value in the R channel component value list of the distribution information is vEnd, since the position information is counted from "0", the position information of vEnd in the system is "15", and there are 2 setting methods for the vEnd value, i.e., the 16 th R channel component value arranged in the statistical order, and the average of the 16 th and subsequent R channel component values arranged in the statistical order.
For example, the statistical result of the distribution of the R values of the color components of the pixels of the rectangular block in table 2 is as follows:
the number of pixels of [ 15 th R-channel component value arranged in statistical order ] RValue ═ 33 is 10 in total;
the number of pixels of [ 16 th R-channel component value in statistical order ] RValue ═ 32 is 9 in total;
the number of pixels of [ 17 th R channel component value in statistical order ] RValue ═ 30 is 4 in total;
the number of pixels of [ 18 th R-channel component value in statistical order ] RValue is 200, and 2 pixels are provided;
at this time, in the first way, vEnd takes the 16 th R-channel component value in the statistical order, that is, vEnd is 32.
In the second way, vEnd is the average of the 16 th and subsequent R channel component values in statistical order, i.e., vEnd ═ 53 (32 × 9+30 × 4+200 × 2)/(9+4+ 2).
In this case, it can be ensured that the accuracy of the image data is not lower than the parameter r specified by the application in the process of storing and processing the source data of the image grid.
Case three: in the statistical result, the number of RValue different values is larger than 16, the proportion of the first 15 types of pixels with the largest number of pixels arranged in sequence in the rectangular block pixels is smaller than the accuracy R value of the given image data, the R channel component value distribution identifier is set to be 3, and 1 byte of storage space is needed.
For example, the statistical result of the distribution of the R values of the color components of the pixels of the rectangular block in table 2 is as follows:
the number of pixels of RVvalue 120 is 20;
the number of pixels of RVvalue 121 is 20;
the number of pixels of RVvalue 222 is 20;
the number of pixels of RVvalue 122 is 20;
the number of pixels of RVvalue 126 is 20;
the number of pixels of RVvalue 223 is 20;
the number of pixels of RVvalue 124 is 20;
the number of pixels of RVvalue 128 is 20;
the number of pixels of RVvalue 127 is 20 in total;
the number of pixels of RVvalue 68 is 20;
the number of pixels of RVvalue 69 is 19;
the number of pixels of RVvalue 46 is 15;
the number of pixels of RVvalue 16 is 14;
the number of pixels of RValue 146 is 13;
the number of pixels of RVvalue 111 is 12 in total;
the number of pixels of RVvalue 55 is 11;
the number of pixels of RVvalue 66 is 10 in total;
the number of pixels of RValue 77 is 9;
……
in this case, the ratio of the top 15 pixels having the largest number of pixels arranged in order to the pixels of the rectangular block (20 × 10+19+15+14+13+12)/(20 × 20) is 68.25%, and the R-channel component value of the pixel of the rectangular block is equal to 90% since the accuracy R of the set image data is 90%. The physical meaning of this case is: the pixel color values of the image in the local area are more in variety, and the values of the pixel color components are dispersed and distributed in various R channel component values.
In this case, the content of the distribution information is as follows:
Figure BDA0002424489320000141
TABLE 5
In this case, the R channel component value of the source data is directly saved in the process of storing and processing the source data of the image grid without any data error and certainly without saving the storage space.
In the case of normal raster image data, where the rectangular block size (row a and column b) is not very large (neither a nor b is greater than 25 pixels), the rectangular block ratio in this case is very small (typically less than 10%) under the condition that the accuracy r of applying specified image data is not higher than 90%, and therefore the applicability of the present method is also very general.
Step three: r-channel component numerical information of the R-value of the pixel color component of the rectangular block is stored.
And processing the rectangular block in the table 2 according to the second step, and then storing the R channel component numerical value of the color component of the rectangular block, wherein the R channel component numerical value is specifically as follows:
for case one: looking at the serial number of the RValue value in the R channel component value list of the distribution information of the rectangular block (numbered from 0, and 15 at the maximum, according to the foregoing steps, it can be determined that the value can be found), if it is w, the storage space is allocated with 4 bits by replacing the RValue value itself with the position information w. After the rectangular block is processed according to the method, the total required storage space is a multiplied by b/2 bytes. Therefore, in the present case, there is no error in the storage processing of the source data R channel component values, but the required storage space is half of the source data storage space.
For case two: checking whether the RVvalue is in an R channel component value list of the distribution information of the rectangular block, and if the RVvalue is in the R channel component value list, replacing the RVvalue with the serial number of the value in the list; if not in the R-channel component value list, the R-channel component value itself is replaced with 15 (i.e., the sequence number of the last R-channel component value in the R-channel component value list). After the rectangular block is processed according to the method, the total required storage space is a multiplied by b/2 bytes. Therefore, the storage processing of the R channel component values of the source data can ensure that the data accuracy of the image is not lower than the R value required by the application, and errors exist in the storage of the R channel component values, but the required storage space is half of that of the source data.
For case three: because the R channel component values of the rectangular blocks are scattered, the R channel component values of the source data are directly adopted for storage, namely, the RValue value is stored by using an integer value of 1 byte. Therefore, in the present case, there is no error in the storage processing of the source data R channel component values, but the required storage space is not reduced.
Each color component of each rectangular block of the image grid source data is processed respectively, and distribution information and R-channel component numerical value information of each rectangular block can be obtained. The distribution information and the R channel component value information of each rectangular block can be respectively and independently stored in a file to form an xx distribution information dat file and an xx channel component value dat file, wherein the xx distribution information dat file stores the distribution information of s × t rectangular blocks; the "xx channel component value dat" file stores channel component value information of s × t rectangular blocks. Of course, the data file can be merged and written in a file, which is a specific method for writing the data file and is not limited in particular.
After the above processing is completed, the file can be stored and transmitted.
The decompression of the raster image data is the reverse operation of the above steps, and is not described again.
In the unit of division adopted when the image grid source data is subjected to region division, the smaller the rectangular block is, the easier the conditions of the first condition and the second condition are met, namely the storage space can be reduced; however, if the size of the rectangular block is too small, the required storage space occupied by the distribution information of the rectangular block increases, and therefore, the size is not suitable for being too small.
In practical use, taking the image grid source data with 1000 rows and 1000 columns as an example, (RGB pixel type), the memory space required by the memory layout is 1000 × 1000 × 3 bytes — 2929KB, and it is assumed that the image data accuracy rate r set by the application is 90%.
When the method is adopted, assuming that the unit of division adopted when the image grid source data is subjected to region division is a rectangular block consisting of 25 rows and 25 columns of pixels, a total of 40 × 40 — 1600 rectangular blocks are obtained, and statistical analysis assumes that 90% of the rectangular blocks satisfy the first and second cases, namely, the required distribution information storage space for the R color component of each rectangular block is 17 bytes, the channel component numerical value information is 25 × 25/2 — 312.5 bytes, and a total of 329.5 bytes is required. All rectangular block memory space after the whole image raster source data is processed needs 1600 × 0.9 × 329.5+1600 × 0.1 × 625 to 561KB, and considering that a general true color image also includes G, B color components, the finally processed memory space needs 561 × 3 to 1683KB, which is about 57% of the memory space of the source data.
When the png format file is used for storing the image raster source data, the obtained file size is 2590KB, and when the lossless tif format file is used for storing, the obtained file size is 2920KB, so that the storage space is hardly reduced. When lossy compression is used, the compression rate is high, but the accuracy of the image cannot be guaranteed.
Therefore, compared with the existing lossless compression files in the lossless TIFF format and the png format, the method of the invention occupies smaller storage space; compared with the existing lossy compression method, the accuracy of the image data can be accurately controlled.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (5)

1.一种图像栅格数据的存储及传输方法,其特征在于,包括以下步骤:1. a storage and transmission method of image grid data, is characterized in that, comprises the following steps: S1、获取图像栅格源数据,预设准确度r,0<r<1;所述图像栅格源数据由多个通道分量组成;S1. Acquire image grid source data, with a preset accuracy r, 0<r<1; the image grid source data is composed of multiple channel components; S2、对图像栅格源数据进行分割,将图像栅格源数据分割为若干个预设固定尺寸的矩形块;不足一个矩形块的部分以0补齐;S2. Divide the image grid source data, and divide the image grid source data into a plurality of rectangular blocks with a preset fixed size; the part that is less than one rectangular block is filled with 0; S3、对步骤S2中获得的矩形块逐个进行以下压缩处理;S3, perform the following compression processing on the rectangular blocks obtained in step S2 one by one; S3-1、统计矩形块内所有像素的各通道分量数值的分布情况,按数值重复次数进行排序,形成通道分量数值列表;S3-1. Count the distribution of the values of each channel component of all pixels in the rectangular block, sort by the number of repetitions of the values, and form a list of channel component values; S3-2、存储矩形块内各通道分量数值的全部或部分分布情况;S3-2, store all or part of the distribution of the component values of each channel in the rectangular block; 所述步骤S3-2包括以下判断步骤:S3-2-1、判断通道分量数值列表中数值的个数是否大于2x个,若是,执行步骤S3-2-2,否则执行步骤S3-2-5;其中x为小于8的正整数;The step S3-2 includes the following judging steps: S3-2-1, judging whether the number of values in the channel component value list is greater than 2 x , if so, go to step S3-2-2, otherwise go to step S3-2- 5; where x is a positive integer less than 8; S3-2-2、判断矩形块中,通道分量数值在通道分量数值列表中前2x个的像素数量占该矩形块所包含总像素的比值是否大于预设的准确度r,若是,执行步骤S3-2-3,否则执行步骤S3-2-4;S3-2-2. In the rectangular block, determine whether the ratio of the number of the first 2 x pixels of the channel component value in the channel component value list to the total pixels contained in the rectangular block is greater than the preset accuracy r, and if so, execute the step S3-2-3, otherwise go to step S3-2-4; S3-2-3、设置通道分量数值分布标识为第二标识值,以2x-1个1字节空间存储通道分量数值列表中前2x-1个值,以1个字节存储通道分量数值列表中第2x个值或者通道分量数值列表中第2x个值及其后续所有值的平均值;跳至步骤S3-3;S3-2-3. Set the channel component value distribution identifier as the second identifier value, store the first 2 x -1 values in the channel component value list in 2 x -1 1-byte spaces, and store the channel components in 1 byte The 2x value in the value list or the average value of the 2x value in the channel component value list and all subsequent values; skip to step S3-3; S3-2-4、设置通道分量数值分布标识为第三标识值,以图像栅格源数据格式储存所有像素数据;跳至步骤S3-3;S3-2-4, set the channel component numerical distribution identifier as the third identifier value, and store all pixel data in the image grid source data format; skip to step S3-3; S3-2-5、设置通道分量数值分布标识为第一标识值,以2x个1字节空间存储通道分量数值列表中所有数值,不足2x部分以0补齐,跳至步骤S3-3;S3-2-5. Set the channel component value distribution identifier as the first identifier value, store all the values in the channel component value list with 2 x 1-byte spaces, and fill in the part less than 2 x with 0, and skip to step S3-3 ; S3-3、以通道分量数值在通道分量数值列表中的位置信息代替通道分量数值本身,并存储,其中所述通道分量数值在通道分量数值列表中的位置信息所需的存储空间小于通道分量数值本身所需的存储空间;或者直接存储通道分量数值本身;S3-3, replace the channel component value itself with the position information of the channel component value in the channel component value list, and store, wherein the storage space required for the position information of the channel component value in the channel component value list is smaller than the channel component value The storage space required by itself; or directly store the channel component value itself; 所述步骤S3-3中,根据不同的通道分量数值分布标识执行不同的步骤:若通道分量数值分布标识为第一标识值,以通道分量数值在通道分量数值列表中的位置信息代替通道分量数值本身,并存储;In the step S3-3, different steps are performed according to different channel component numerical distribution identifiers: if the channel component numerical distribution identifier is the first identifier value, the channel component numerical value is replaced by the position information of the channel component numerical value in the channel component numerical value list. itself, and store it; 若通道分量数值分布标识为第二标识值,对于通道分量数值列表中存储的通道分量数值,以其在通道分量数值列表中的位置信息代替通道分量数值本身;对于通道分量数值列表中未存储的通道分量数值,以2x -1代替通道分量数值本身;If the channel component value distribution identifier is the second identifier value, for the channel component value stored in the channel component value list, the channel component value itself is replaced by its position information in the channel component value list; for the channel component value not stored in the channel component value list. channel component value, replace the channel component value itself with 2 x -1; 若通道分量数值分布标识为第三标识值,按图像栅格源数据的原始存储方式存储;If the channel component numerical distribution identifier is the third identifier value, it is stored in the original storage mode of the image grid source data; S4、对经上述压缩处理的图像栅格数据进行存储和传输;S4, storing and transmitting the image raster data subjected to the above compression processing; S5、按步骤S1~S3相反的次序进行图像栅格数据的解压缩还原。S5. Decompress and restore the image raster data in the reverse order of steps S1-S3. 2.根据权利要求1所述的图像栅格数据的存储及传输方法,其特征在于,以1字节存储所述通道分量数值分布标识。2 . The method for storing and transmitting image grid data according to claim 1 , wherein the channel component numerical value distribution identifier is stored in 1 byte. 3 . 3.根据权利要求1或2所述的图像栅格数据的存储及传输方法,其特征在于,所述矩形块的最长边取10至30之间的整数值。3 . The method for storing and transmitting image raster data according to claim 1 or 2 , wherein the longest side of the rectangular block takes an integer value between 10 and 30. 4 . 4.根据权利要求1或2所述的图像栅格数据的存储及传输方法,其特征在于,所述x=4。4 . The storage and transmission method of image raster data according to claim 1 or 2 , wherein the x=4. 5 . 5.根据权利要求1或2所述的图像栅格数据的存储及传输方法,其特征在于,将步骤S2中切割好的多个所述矩形块,分配给多个终端进行分布式同步处理。5 . The method for storing and transmitting image grid data according to claim 1 or 2 , wherein the plurality of rectangular blocks cut in step S2 are allocated to a plurality of terminals for distributed synchronization processing. 6 .
CN202010216168.1A 2020-03-25 2020-03-25 Storage and transmission method of image raster data Active CN111405294B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010216168.1A CN111405294B (en) 2020-03-25 2020-03-25 Storage and transmission method of image raster data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010216168.1A CN111405294B (en) 2020-03-25 2020-03-25 Storage and transmission method of image raster data

Publications (2)

Publication Number Publication Date
CN111405294A CN111405294A (en) 2020-07-10
CN111405294B true CN111405294B (en) 2022-02-15

Family

ID=71413961

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010216168.1A Active CN111405294B (en) 2020-03-25 2020-03-25 Storage and transmission method of image raster data

Country Status (1)

Country Link
CN (1) CN111405294B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579597B (en) * 2020-12-15 2023-03-21 西安邮电大学 Compression-sensitive database file storage method and system
CN112712570B (en) * 2020-12-22 2023-11-24 抖音视界有限公司 Image processing method, device, electronic equipment and medium
CN113704208B (en) * 2021-10-27 2022-02-08 浙江闪铸三维科技有限公司 Compression method of 3D printing file

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5883633A (en) * 1997-04-15 1999-03-16 Microsoft Corporation Method and system of variable run length image encoding using sub-palette
CN103093413B (en) * 2013-01-14 2015-08-19 北京地拓科技发展有限公司 A kind of remote sensing image data write and the method and apparatus read
CN110083735B (en) * 2019-04-22 2021-11-02 广州方硅信息技术有限公司 Image screening method and device, electronic equipment and computer readable storage medium
CN110769211A (en) * 2019-11-07 2020-02-07 鲁东大学 Image raster data transmission and storage method

Also Published As

Publication number Publication date
CN111405294A (en) 2020-07-10

Similar Documents

Publication Publication Date Title
CN111405294B (en) Storage and transmission method of image raster data
US11790560B2 (en) Methods and decompression units for decompressing a compressed block of image data
US20050041034A1 (en) Method for representing a digital color image using a set of palette colors based on detected important colors
JP2000196907A (en) Method for selecting color to be assigned to pixel and method for encoding and storing picture
WO1994000949B1 (en) Video compression and decompression using block selection and subdivision
CN105933708B (en) A kind of method and apparatus of data compression and decompression
US12282842B2 (en) Neural network processing apparatus, neural network processing method, and neural network processing program
CN115550661B (en) Image compression method, restoration method, computing device and readable storage medium
JPH02228879A (en) Method of compacting data
CN114020510A (en) Correction coefficient compression method, device and storage method
CN107147914A (en) An embedded system, a monochrome bitmap compression method, and a host computer
CN110769211A (en) Image raster data transmission and storage method
CN1909672A (en) Storage method and system for displaying pictures
CN110619667B (en) PNG picture compression method and system
CN116894457B (en) Network weight access method of deep learning model
CN1295652C (en) Image data encoding method
US7468733B2 (en) Method and system for improving color reduction
CN115996291B (en) Color image compression method and device with image noise reduction function and electronic equipment
CN115543944B (en) A method for lossless compression storage and reading of classified raster data
CN119229801A (en) A color brightness correction method for LED display screen and a correction coefficient encoding and decoding method
CN119450067A (en) An image compression method, DNA encoding method and related devices
JP2601169B2 (en) Image data compression coding system
CN113436347A (en) Three-dimensional image compression method
CN115938285A (en) A LED display correction coefficient encoding and decoding method
CN116778005A (en) Dynamic mask generation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant