The compression method and device of image and its compression method and device of character block
Technical field
The present invention relates to image processing fields, the compression method and device in particular to a kind of image and its word
The compression method and device of block.
Background technology
Recently, in field of video transmission, we are usually taken partition to carry out compression processing to image, so that its
Compression performance is more excellent.In general, character block can cause the highest attention of human vision performance, this will guide us to be dedicated to grinding
Study carefully the innovation of character block compress technique.In existing technology, character block is first divided into domain color and non-domain color, then successively
Domain color is put into palette, the compression processing of palette table is carried out to entire character block, image can be improved in such method
Compression performance.But the number of colors in the palette table that the technology generates is more, and excessive color will be such that code efficiency drops
It is low.
For when being compressed in the prior art to character block since the number of colors in palette table excessively causes to compress
The low problem of effect, currently no effective solution has been proposed.
Invention content
An embodiment of the present invention provides the compression method and device of a kind of compression method of image and device and its character block,
Since the number of colors in palette table excessively causes compression to be imitated when at least solving in the prior art to compress character block
The low technical problem of fruit.
One side according to the ... of the embodiment of the present invention provides a kind of compression method of character block in image, including:It obtains
The basic colors of each character block in image;Multiple dominant color sets are synthesized according to the basic colors of each character block;According to
Multiple dominant color sets constitute the palette table of described image;According to the basic colors of the palette table and each character block
Each character block is encoded, the compressed bit stream of character block in described image is obtained.
Another aspect according to the ... of the embodiment of the present invention additionally provides a kind of method for compressing image, including above-mentioned image Chinese
The compression method of block, wherein according to the basic colors concordance list of the palette table and each character block to described
After each character block is encoded, method for compressing image further includes:Non-legible piece in described image is obtained, and by institute
Non-legible piece is stated to be encoded to obtain non-legible piece of compressed bit stream;By the compressed bit stream of the character block and non-legible piece described
Compressed bit stream be transmitted to decoding end.
One side according to the ... of the embodiment of the present invention provides a kind of compression set of character block in image, including:It obtains
Module, the basic colors for obtaining each character block in image;Synthesis module, for according to the basic of each character block
Color synthesizes multiple dominant color sets;Module is constituted, the palette table for constituting described image according to multiple dominant color sets;Coding
Module, for being encoded to each character block according to the basic colors of the palette table and each character block,
Obtain the compressed bit stream of character block in described image.
One side according to the ... of the embodiment of the present invention provides a kind of image compressing device, including character block in image
Compression set, wherein image compressing device further includes:Non-legible block coding module, it is non-legible in described image for obtaining
Block, and by being encoded to obtain non-legible piece of compressed bit stream to described non-legible piece;Transmission module is used for the word
The compressed bit stream of block and non-legible piece of the compressed bit stream are transmitted to decoding end.
Herein it should be noted that the compression efficiency of image can be improved by reducing the color in palette table, but if with
Meaning reduces the color in palette table, it is likely that reduces the compression effectiveness of image, therefore this programme is used by each character block
Basic colors synthesize multiple dominant color sets, then synthesize by multiple dominant color sets the mode of palette table and remove in palette table
Redundancy color, to reduce the color in palette table.
In embodiments of the present invention, the basic colors for obtaining each character block in image, according to each character block
Basic colors synthesizes multiple dominant color sets, the palette table of described image is constituted according to multiple dominant color sets, according to the toning
The basic colors of plate table and each character block encodes each character block, obtains character block in described image
Compressed bit stream.Said program by the basic colors of each character block by synthesizing multiple dominant color sets, then by multiple dominant color sets
Palette table is constituted, the number of colors in palette table is reasonably reduced, so as to avoid during generating palette table,
The Color Statistical of redundancy is entered, coding efficiency is made to reduce, so solve when being compressed in the prior art to character block by
The technical problem that number of colors in palette table excessively causes compression effectiveness low.
Description of the drawings
Attached drawing described herein is used to provide further understanding of the present invention, and is constituted part of this application, this hair
Bright illustrative embodiments and their description are not constituted improper limitations of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is the flow chart of the compression method of character block in image according to the ... of the embodiment of the present invention;
Fig. 2 is the flow chart of method for compressing image according to the ... of the embodiment of the present invention;
Fig. 3 is a kind of flow chart of optional method for compressing image according to the ... of the embodiment of the present invention;
Fig. 4 is the schematic diagram of the compression set of character block in image according to the ... of the embodiment of the present invention;
Fig. 5 is the schematic diagram of the compression set of character block according to the ... of the embodiment of the present invention;
Fig. 6 is a kind of schematic diagram of optional image Compression equipment according to the ... of the embodiment of the present invention.
Specific implementation mode
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people
The every other embodiment that member is obtained without making creative work should all belong to the model that the present invention protects
It encloses.
It should be noted that term " first " in description and claims of this specification and above-mentioned attached drawing, "
Two " etc. be for distinguishing similar object, without being used to describe specific sequence or precedence.It should be appreciated that using in this way
Data can be interchanged in the appropriate case, so as to the embodiment of the present invention described herein can in addition to illustrating herein or
Sequence other than those of description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that cover
It includes to be not necessarily limited to for example, containing the process of series of steps or unit, method, system, product or equipment to cover non-exclusive
Those of clearly list step or unit, but may include not listing clearly or for these processes, method, product
Or the other steps or unit that equipment is intrinsic.
Embodiment 1
According to embodiments of the present invention, the embodiment for providing the compression method of character block in a kind of image needs to illustrate
It is that step shown in the flowchart of the accompanying drawings can execute in the computer system of such as a group of computer-executable instructions,
Also, although logical order is shown in flow charts, and it in some cases, can be to be executed different from sequence herein
Shown or described step.
Fig. 1 is the flow chart of the compression method of character block in image according to the ... of the embodiment of the present invention, as shown in Figure 1, the party
Method includes the following steps:
Step S102 obtains the basic colors of each character block in image.
, can be by block of W × H points of the frame image for m × n in screen video in above-mentioned steps, and utilize word
Block is divided into character block and non-legible piece by characteristic, and size is (W/m) × (H/n), to obtain the character block in image.
In above-mentioned steps, the ratio of all colours value in each character block can be accounted for each color in each character block
The foundation of domain color as each character block of determination, therefore main face can be determined for the actual conditions of each character block
Color, that is to say, that the domain color of each character block in adaptive determination image may be implemented.
Step S104 synthesizes multiple dominant color sets according to the basic colors of each character block.
It is synthesized by the basic colors of each character block specifically, various ways may be used in above-mentioned multiple dominant color sets,
For example, different in each word domain color quantity in the block, can by character block according to domain color quantity into
Row classification, and similar word domain color in the block is synthesized into a dominant color set, to obtain multiple dominant color sets.Example again
Such as, domain color quantity is identical in each character block, can also be according to the color value of domain color in each character block
Classify, and domain color is generated into multiple dominant color sets according to the classification of color value.
Step S106 constitutes the palette table of image according to multiple dominant color sets.
Specifically, above-mentioned palette table includes the index value of all domain colors and all domain colors in image, or part is main
The index value of a few part domain colors of color, for the pixel for domain color in image to be indicated with corresponding index value, from
And the generation in the cataloged procedure of image to reduction satellite information.
Step S108 encodes each character block according to the basic colors of palette table and each character block, obtains
The compressed bit stream of character block in image.
Compared with prior art, its current character block is individually compressed in the prior art, does not make full use of screen but
The characteristic of character block in curtain video image uses unified number when to domain color and non-master color classification to each character block
Domain color, therefore cause compression performance relatively low, and the application said program realize it is adaptive true to different character blocks
The domain color of fixed different numbers, to improve compression performance.
Herein it should be noted that the color reduced in palette table can improve the compression efficiency of image, but if subtracting
Random color in few palette table, it is likely that reduce the compression effectiveness of image, therefore this programme is used by each character block
Basic colors synthesize multiple dominant color sets, then synthesize by multiple dominant color sets the mode of palette table and remove in palette table
Redundancy color, to reduce the color in palette table.
From the foregoing, it will be observed that the application said program obtains the basic colors of each character block in image, according to each text
The basic colors of block synthesizes multiple dominant color sets, the palette table of described image is constituted according to multiple dominant color sets, according to institute
The basic colors for stating palette table and each character block encodes each character block, obtains described image Chinese
The compressed bit stream of block.Said program by the basic colors of each character block by synthesizing multiple dominant color sets, then by multiple masters
Color table constitutes palette table, reasonably reduces the number of colors in palette table, so as to avoid palette table is being generated
In the process, the Color Statistical of redundancy is entered, coding efficiency is made to reduce, and then solved and character block is pressed in the prior art
Due to technical problem that the number of colors in palette table excessively causes compression effectiveness low when contracting.
Optionally, according to the above embodiments of the present application, the basic colors of each character block in image is obtained, including:
Step S1021, counts the quantity that each color value occurs in current character block, and according to the quantity of appearance by greatly to
It is small to be ranked up.
Step S1023 determines that top n color value is the basic colors of character block in ranking results.
In above-mentioned steps, the number for the domain color that each different character block has is identical N number of.
In a kind of optional embodiment, if the number for the domain color that each different character block has is identical pre-
If number, then the domain color number of each character block is a fixed number in image, is N in the number for determining domain color
Afterwards, the number occurred to the color value of each character block takes in ranking results top n color value as text from greatly to small sequence
The domain color of block.
Optionally, according to the above embodiments of the present application, multiple dominant color sets are synthesized according to the basic colors of each character block,
Including:
Step S1041, the quantity occurred according to the basic colors of each character block are ranked up, and obtain each character block
Basic colors ranking results.
In above-mentioned steps, the mode of sequence can be the quantity that occurs of basic colors from large to small, can also be basic
The quantity that color occurs from small to large, does not limit specifically, but it needs to be determined that each character block sortord all same.
Step S1043 is arranged each word basic colors in the block and identifies, wherein has in ranking results identical
The basic colors mark having the same of arrangement position.
In above-mentioned steps, N number of basic colors that each character block sorts according to quantity, in a kind of optional embodiment
In, by taking N=4 as an example, the basic colors of arrangement first in each character block can be collectively labeled as 0, will be arranged in each character block
The basic colors of row second is collectively labeled as 1, the basic colors that third is arranged in each character block is collectively labeled as 2, each word
The basic colors of arrangement the 4th is collectively labeled as 3 in block.When each character block has more or fewer basic colors, with such
It pushes away, further, the corresponding expression of basic colors of each arrangement position is not specifically limited, the basic face of different arrangement positions
The corresponding mark of color is misaligned.
Basic colors with like-identified is blended into the same dominant color set by step S1045, and is carried out at duplicate removal
Reason, obtains N number of dominant color set.
In a kind of optional embodiment, still by taking above-mentioned N=4 as an example, the basic colors for being can be marked to synthesize by all
First dominant color set I0, mark the basic colors for being to synthesize the first dominant color set I by all1, the basic face for being is marked by all
Color synthesizes the first dominant color set I2, mark the basic colors for being to synthesize the first dominant color set I by all3, respectively to I0、I1、I2、
I3Duplicate removal processing is carried out respectively, so as to obtain 4 dominant color set I0、I1、I2、I3。
Further, after the basic colors with like-identified is blended into the same domain color, it is also necessary to be gone
It handles again, specifically, N number of dominant color set can be obtained with pass-through mode, the first master of basic colors synthesis for being is marked by all
Color table I0For, the basic colors for being will be marked to be added in preset dominant color set in first character block, then successively will
It marks the basic colors for being to be added in the preset dominant color set in other character blocks, is adding any one basic colors
In the process, if the basic colors that existing preparation is added in preset dominant color set, without adding again, to realize
The duplicate removal of basic colors.
Optionally, according to the above embodiments of the present application, the palette table of image is constituted according to multiple dominant color sets, including:
Step A1:Basic colors in first basic colors table is added to initial palette table, constitutes the first middle tone
Colour table table, wherein initial palette table is sky.
Step B1:By in the second basic colors table basic colors and the first intermediate palette table compare, if the second base
The basic colors of this color table is present in the first intermediate palette table, then retains basic colors, otherwise, by basic colors table
Basic colors is added in the first intermediate palette table, constitutes the second intermediate palette table, and mix colours being added among first
Index value is arranged in basic colors in plate table.
Step C1:Circulation step B1 determines finally obtained intermediate toning until each basic colors table is completed to compare
Plate table is palette table.
In a kind of optional embodiment, with the simple frame image including 3 character blocks as an example, three character blocks
Domain color be respectively (A1, B1, C1), (A1, B2, C1, D2, E2), (A3, B2, C1, E2), initial palette table be sky, first
It is compared with initial palette table using first character block, initial palette table does not include the master of first character block certainly
Color, therefore first word domain color in the block is added to initial palette table, and its index value is set, it obtains among first
Palette table, at this point, the first intermediate palette table includes (A1, B1, C1) and its index value;Then by second character block with
First intermediate palette table is compared, due to second word A1 in the block, C1 occur in first character block, therefore
When second character block and the first intermediate palette table are compared, only B2, D2 and E2 do not occur, therefore first
B2, D2 and E2 is added in intermediate palette table, and B2 is set, the index value of D2 and E2, at this point, in global basic colors table
Including domain color (A1, B1, C1, B2, D2, E2) and its index value, the second intermediate palette table is obtained;Then by third word
Block and the second intermediate palette table are compared, and compared with the second intermediate palette table, the difference of third character block is to include
Domain color A3, therefore palette table includes (A1, B1, C1, B2, D2, E2, A3) and its index value among third, and determine third
Intermediate palette table is final palette table.
From the foregoing, it will be observed that the application said program limits the color in palette table by preset condition, to
Reduce the color in palette table, and then the compression efficiency of image has been turned up.
Optionally, according to the above embodiments of the present application, according to the palette table of multiple dominant color set composographs, including:
Step A2:Basic colors in first basic colors table is added to initial palette table, constitutes the first middle tone
Colour table table, wherein initial palette table is sky;
Step B2:By in the second basic colors table basic colors and the first intermediate palette table compare, if the second base
The basic colors of this color table is present in the first intermediate palette table, then retains basic colors, otherwise, by basic colors table
Basic colors is added in the first intermediate palette table, constitutes the second intermediate palette table, and mix colours being added among first
Index value is arranged in basic colors in plate table;
Step C2:Circulation step B2, until each basic colors table is completed to compare, by finally obtained intermediate palette
The basic colors for meeting preset condition in table constitutes palette table.
In a kind of optional embodiment, still with the simple frame image including 3 character blocks as an example, in the example
In, after obtaining palette table among third and including (A1, B1, C1, B2, D2, E2, A3) and its index value, not by third
Intermediate palette table further carries out the basic colors in palette table among third as final palette table
Screening improves the compression efficiency of image to further reduce the number of colors in palette.
Optionally, according to the above embodiments of the present application, preset condition is to include:The quantity P of basic colors in palette table
It is greater than or equal to the first preset value and/or P with the ratio of the quantity of all basic colors in finally obtained intermediate palette table
Less than the second preset value, wherein P is positive integer, and the color value of P basic colors is more than the face of remaining color in intermediate palette
Color value.
It is completed in being obtained after comparing specifically, above-mentioned finally obtained intermediate palette table is each basic colors table
Between palette table, above-mentioned first preset value can be 90%, the second preset value can be 4096, in a kind of optional embodiment
In, said program can be realized in the following way, it can be to M face in finally obtained intermediate palette table palette table
After color sorts according to frequency size, if the color of front J meets(T is threshold value, such as T=90%), then just utilizing J
A color is as the palette table for image coding.
Optionally, according to the above embodiments of the present application, step S108, according to the basic face of palette table and each character block
Color encodes each character block, including:
Step S1081 generates the basic colors of each character block according to the basic colors of palette table and each character block
Concordance list.
In a kind of optional embodiment, the scene in the still above embodiment is described, the step for process it is real
It is that the main face of each character block is indicated using the corresponding index value of color in palette table after obtaining palette table on border
Color.
It should be noted that the quantity for the character block for including per frame image is indefinite, but it is usually all more, above-mentioned includes three
The image of character block is given for example only.
Step S1083 is obtained often according to the basic colors concordance list of the basic colors of each character block and each character block
The marked index table and relative index table of a character block, wherein in the basic colors table that marked index table passes through each character block
Index value indicate that character block, relative index table are obtained by the relationship of neighborhood index value in marked index table.
After obtaining the basic colors concordance list of palette table and each character block, it can be searched according in palette table
The basic colors of each character block, to obtain the marked index table of each character block, and according to neighborhood rope in marked index table
Draw the relationship between value and obtains relative index table.
Step S1085 encodes each character block according to the marked index table of each character block and relative index table.
Index value in the basic colors concordance list for passing through each character block due to marked index table indicates character block, phase
It closes concordance list to obtain by the relationship of neighborhood index value in marked index table, therefore according to marked index table and relative index table pair
Character block is encoded relative to directly for character block encodes, and has higher code efficiency.
Optionally, according to the above embodiments of the present application, step S1083, according to the basic colors of each character block and each
The basic colors concordance list of character block obtains the marked index table of each character block, including:
Step S1083a determines each color value pair in each character block according to the basic colors concordance list of each character block
The mark answered.
Step S1083b generates corresponding index value according to the corresponding mark of each color value in each character block, according to
The index value of each color value constitutes marked index table in each character block.
Due to before the step of obtained the basic colors table of each character block, can be in above-mentioned steps using every
The basic colors table of a character block indicates each character block.
It, can be respectively above-mentioned by taking the domain color of current character block is a, b, c, d as an example in a kind of optional embodiment
The corresponding mark 0,1,2,3, therefore in the character block of domain color distribution, if the color of pixel is a, label be, if
The color of pixel is b, then is labeled as 1, if the color of pixel is c, is labeled as 2, if the color of pixel is d, marks
It is 3, if the color of pixel is non-basic colors, 4 is labeled as, to obtain the corresponding marked index table of character block.
It should be noted that be in above-mentioned marked index table each basic colors and non-basic colors setting ident value simultaneously
It is not necessarily identical as example, it is the arbitrary different value that can be distinguished.
Optionally, according to the above embodiments of the present application, step S1083, according to the basic colors of each character block and each
The basic colors concordance list of character block obtains the relative index table of each character block, including:
Step S1083c determines being associated with for the corresponding index value of each color value and neighborhood index value in each character block
System.
Step S1083d, according to the corresponding index value of each color value in each character block whether with neighborhood index value phase
Together, it determines the corresponding relation identity of each color value, and relative index table is constituted according to the corresponding relation identity of each color value.
Specifically, above-mentioned incidence relation is for indicating the corresponding index value of each color value and neighborhood rope in each character block
Whether identical draw value.
In a kind of optional embodiment, for character block from top to bottom encode, word each picture in the block
Element only needs the pixel with the pixel in left side and upside to be compared, therefore can only determine pixel and left side, upside pixel
Incidence relation, if the sequence of coding is that have that pixel is needed to be compared with the pixel on right side from right to left, if coding
Sequence is that have from the bottom to top, then pixel is needed to be compared with the pixel of downside.For example, the index of each character block can be scanned
Value, if pixel is identical as the index value of the pixel on the left side, is calculated as L, similar to the index value of top, is calculated as U, otherwise counts
For O, then the relative index table of character block can be obtained.
Optionally, according to the above embodiments of the present application, step S1085, according to the marked index table and phase of each character block
Concordance list is closed to encode each character block, including:
Step S1085a, the original color value of the pixel of the non-basic colors of color value in recording mark concordance list, and be based on
Marked index table passes each color value using the coding mode based on bit plane successively from highest bit plane to minimum bit plane
It is defeated, generate the first compressed bit stream of character block in image.
Step S1085b carries out monodrome huffman coding according to relative index table, and to each pixel in horizontal direction,
Or the pixel in level is grouped with predetermined number, and multivalue huffman coding is carried out to every group of pixel after grouping, it obtains
To the second character block compressed bit stream in the compressed bit stream of character block.
It should be noted that since above-mentioned steps can carry out multivalue Huffman to every group of pixel after grouping
(Huffman) it encodes, therefore can be using the relationship of the color value for the neighborhood territory pixel that relative index table is recorded, for example, with water
Square upward six pixels are as one group, if the mark recorded in relative index table is identical as the color value of the pixel in left side,
Then with regard to without being encoded successively to each pixel, greatly improving code efficiency.
Embodiment 2
According to embodiments of the present invention, a kind of embodiment of method for compressing image is provided, it should be noted that in attached drawing
The step of flow illustrates can execute in the computer system of such as a group of computer-executable instructions, although also,
Logical order is shown in flow chart, but in some cases, it can be to execute shown different from sequence herein or retouch
The step of stating.
Fig. 2 is the figure of any one in the flow chart of method for compressing image according to the ... of the embodiment of the present invention, including embodiment 1
As in character block compression method, as shown in Fig. 2, according to the basic colors concordance list of palette table and each character block to every
After a character block is encoded, this method further includes:
Step S201 obtains non-legible piece in image, and by being encoded to obtain non-legible piece to non-legible piece
Compressed bit stream.
The compressed bit stream of character block and non-legible piece of compressed bit stream are transmitted to decoding end by step S203.
Fig. 3 is a kind of flow chart of optional method for compressing image according to the ... of the embodiment of the present invention, shown in Fig. 3
Example, a kind of optional method for compressing image is described:
S31 carries out piecemeal to current frame image.
Frame W × the H in screen video is obtained, and is divided into the block of m × n.
Whether the type of S32, decision block are character block.
Block is divided into character block and non-legible piece using the characteristic of word, size is (W/m) × (H/n).After piecemeal successively
The type for judging each block then enters step S33 if it is character block, and S38 is entered step if if it is non-legible piece.
S33 counts the number that each color occurs in character block, and is ranked up.
S34 generates four dominant color sets and progress growth palette table G according to four basic colors in each word.
In a kind of optional embodiment, initialization palette table G is sky.Count each of each character block in each frame
The number that color value occurs, and be ranked up according to its size, preceding four colors of sequence are found out in each character block i.e.
It is exactly domain color S (S=4).For the i-th character block, the number that each color value occurs in character block is counted through above-mentioned steps, is looked for
Go out its Si (Si=4) a domain color, entitled domain color 0 is arranged in most we of the frequency of occurrences, more than occurrence number of taking second place
It is domain color 2 mostly occurrence number of relatively taking second place for domain color 1, last is known as domain color 3, then extracts in the character block
The color value of domain color 0, and it is recorded as the dominant color set I of current character block0.For i+1 character block, find out its four
A domain color simultaneously extracts the color value that domain color in the character block is 0 and is added to dominant color set I0In, if in i+1 character block
Domain color 0 color value it is equal with the color value of domain color 0 of i-th of character block, then being continuing with i-th character block
The color value that domain color is 0, if two values are unequal, then the new color value of the domain color 0 of i+1 is added to domain color
I0It is updated in table, the complete dominant color set I of final updated will be obtained after having handled all character blocks0.By current block domain color
Table I0It is compared with palette table G, if I0In basic colors value in G, using in palette table G index value expression work as
Preceding piece of domain color is 0 color value;If I0In some domain color 0 color value not in G, current in the block this is newly gone out
The color value that existing domain color is 0 is added in palette table G, and uses this index value of new color value in palette table
To indicate the domain color of current block.And then the dominant color set I that domain color is 1 is generated1, and put it into palette table,
Principle is identical, and so on, I2, I3Also it will sequentially be put into palette according to this.
S35 obtains the basic colors in palette G.
Whether the basic colors in S36, palette table G meets preset condition.
If the basic colors in palette G meets preset condition, S37 is entered step, if basic in palette G
Color is unsatisfactory for preset condition, then enters step S35, reacquires the basic colors in palette G.In a kind of optional implementation
In example, four are respectively I0, I1, I2, I3Dominant color set generate palette table G, to N number of color in palette table according to
After the sequence of frequency size, if the color of front J meets(T is threshold value, such as T=90%), then just utilizing J color
As new palette table.
S37, word block coding.
It, can be according to the dominant color set I of current i-th of character block in above-mentioned steps0, I1, I2, I3, in the block to word
Each color is compared with it, if the color value and Table I of character block0, I1, I2, I3Intermediate value is identical, then it is assumed that herein
Pixel be main color position, be indicated using index value 0~(Si-1), differed if contrasting to be worth, then it represents that herein as
Element is non-master color position, is indicated using Si, therefore each character block can be recorded according to multiple domain colors and non-domain color
Corresponding index value marks character block to generate concordance list Ci.The index value Ci for scanning each character block, finds itself and neighbour
The relevant information of AN domain index value, similar to surface pixel to be calculated as U if similar to leftmost pixel be calculated as L, all dissmilarities are calculated as O,
To obtain concordance list Bi.For concordance list Bi, the pixel of several in horizontal direction can be divided into one group, used
Huffman is encoded.
S38, non-legible block coding.
Need to record the actual value of each color value for the pixel value of the non-master color position in concordance list Ci.Color is each
A component value is all transmitted using the coding mode based on bit plane from highest bit plane to minimum bit plane successively, to be divided
At word compressed bit stream.For each non-legible piece using other encryption algorithms (such as:Jpeg coder).
S39 organizes code stream.
It is streamed to decoding end according to character block code stream, non-legible block code, decoding end carries out the code stream of different type block
It decodes and shows.
Embodiment 3
According to embodiments of the present invention, a kind of embodiment of the compression set of character block in image is provided, Fig. 4 is according to this
The schematic diagram of the compression set of character block in the image of inventive embodiments, the device include:
Acquisition module 40, the basic colors for obtaining each character block in image.
Synthesis module 42, for synthesizing multiple dominant color sets according to the basic colors of each character block.
Module 44 is constituted, the palette table for constituting image according to multiple dominant color sets.
Coding module 46, for being compiled to each character block according to the basic colors of palette table and each character block
Code, obtains the compressed bit stream of character block in image.
Optionally, according to the above embodiments of the present application, acquisition module includes:
Statistic submodule, for counting the quantity that each color value occurs in current character block, and according to the quantity of appearance
It is descending to be ranked up.
First determination sub-module, for determining, top n color value is the basic colors of character block in ranking results.
Optionally, according to the above embodiments of the present application, synthesis module includes:
Sorting sub-module, the quantity for being occurred according to the basic colors of each character block are ranked up, and obtain each text
The basic colors ranking results of block.
Submodule is set, is identified for each word basic colors in the block to be arranged, wherein have in ranking results
The basic colors mark having the same of aligned identical position.
Submodule being synthesized, for there will be the basic colors of like-identified to be blended into the same dominant color set, and being carried out
Duplicate removal processing obtains N number of dominant color set.
Optionally, according to the above embodiments of the present application, constituting module includes:
First constitutes submodule, for the basic colors in the first basic colors table to be added to initial palette table, structure
At the first intermediate palette table, wherein initial palette table is sky.
Second constitutes submodule, is used for the basic colors and the first intermediate palette table ratio in the second basic colors table
It is right, if the basic colors of the second basic colors table is present in the first intermediate palette table, retain basic colors, otherwise,
The basic colors of basic colors table is added in the first intermediate palette table, constitutes the second intermediate palette table, and to addition
To the basic colors in the first intermediate palette table, index value is set.
First circulation submodule executes the second composition submodule, until each basic colors table completes ratio for recycling
It is right, determine that finally obtained intermediate palette table is palette table.
Optionally, according to the above embodiments of the present application, constituting module includes:
Third constitutes submodule, for the basic colors in the first basic colors table to be added to initial palette table, structure
At the first intermediate palette table, wherein initial palette table is sky.
4th constitutes submodule, is used for the basic colors and the first intermediate palette table ratio in the second basic colors table
It is right, if the basic colors of the second basic colors table is present in the first intermediate palette table, retain basic colors, otherwise,
The basic colors of basic colors table is added in the first intermediate palette table, constitutes the second intermediate palette table, and to addition
To the basic colors in the first intermediate palette table, index value is set.
Second circulation submodule executes the 4th composition submodule, until each basic colors table completes ratio for recycling
It is right, the basic colors that preset condition is met in finally obtained intermediate palette table is constituted into palette table.
Optionally, according to the above embodiments of the present application, the preset condition is to include:Basic colors in the palette table
Quantity P and the finally obtained intermediate palette table in the ratios of quantity of all basic colors to be greater than or equal to first pre-
If value and/or the P are less than the second preset value, wherein the P is positive integer, and the color value of the P basic colors is more than
The color value of remaining color in the intermediate palette.
Optionally, according to the above embodiments of the present application, coding module includes:
Submodule is generated, for generating the basic of each character block according to the basic colors of palette table and each character block
Color index table.
Acquisition submodule, for being obtained according to the basic colors of each character block and the basic colors concordance list of each character block
To the marked index table and relative index table of each character block, wherein the basic colors that marked index table passes through each character block
Index value in table indicates that character block, relative index table are obtained by the relationship of neighborhood index value in marked index table.
Word block coding module is used for marked index table and relative index table according to each character block to each character block
It is encoded.
Optionally, according to the above embodiments of the present application, acquisition submodule includes:
First determination unit, for determining each face in each character block according to the basic colors concordance list of each character block
The corresponding mark of color value.
Component units, for generating corresponding index value, root according to the corresponding mark of each color value in each character block
Marked index table is constituted according to the index value of each color value in each character block.
Optionally, according to the above embodiments of the present application, acquisition submodule further includes:
Second determination unit, for determining the corresponding index value of each color value and neighborhood index value in each character block
Incidence relation.
Third determination unit, for according to the corresponding index value of each color value in each character block whether with neighborhood index
It is worth identical, determines the corresponding relation identity of each color value, and related rope is constituted according to the corresponding relation identity of each color value
Draw table.
Optionally, according to the above embodiments of the present application, word block coding module includes:
First coding unit is used for the original color value of the pixel of the non-basic colors of color value in recording mark concordance list,
And use the coding mode based on bit plane from highest bit plane to minimum bit plane each color value based on marked index table
It transmits successively, generates the first character block compressed bit stream in the compressed bit stream of character block.
Second coding unit, for carrying out monodrome Hough according to relative index table, and to each pixel in horizontal direction
Graceful coding, or the pixel in level is grouped with predetermined number, and multivalue Huffman is carried out to every group of pixel after grouping
Coding, obtains the second character block compressed bit stream in the compressed bit stream of character block.
Embodiment 4
According to embodiments of the present invention, a kind of embodiment of image compressing device, including any one in embodiment 3 are provided
The compression set of character block in image, Fig. 5 are the schematic diagram of the compression set of character block according to the ... of the embodiment of the present invention, the image
Compression set further includes:
Non-legible block coding module 50, for obtaining non-legible piece in image, and by being encoded to non-legible piece
Obtain non-legible piece of compressed bit stream.
Transmission module 52, for the compressed bit stream of character block and non-legible piece of compressed bit stream to be transmitted to decoding end.
Fig. 6 is a kind of schematic diagram of optional image Compression equipment according to the ... of the embodiment of the present invention, in conjunction with Fig. 6 institutes
Showing, vision facilities obtains the frame in screen video, and the type of each block after image block is identified using block type identification module,
Character block is encoded by word block coding module, non-legible piece is encoded by non-legible block coding module, is led to
Cross the receiving device that the code stream after coding is sent to decoding end by code stream organization module by sending device, receiving device is by code stream
It is sent to code stream and splits module, code stream splits the compressed bit stream and non-legible piece of compressed code that code stream is split as character block by module
Stream, then the compressed bit stream of character block is decoded by character block decoder module and is exported to frame display module, pass through non-text
Block decoder module is decoded non-legible piece of compressed bit stream and exports to frame display module, and frame display module will finally be shown
Show that result is exported to display equipment, to complete the compression processing of image.The compression of character block in the image that above-described embodiment 1 provides
The method for compressing image that method and embodiment 2 provide is suitable for above-mentioned image Compression equipment, and is mainly used for coding side
In word block coding module.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
In the above embodiment of the present invention, all emphasizes particularly on different fields to the description of each embodiment, do not have in some embodiment
The part of detailed description may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents can pass through others
Mode is realized.Wherein, the apparatus embodiments described above are merely exemplary, for example, the unit division, Ke Yiwei
A kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units or component can combine or
Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Between coupling, direct-coupling or communication connection can be INDIRECT COUPLING or communication link by some interfaces, unit or module
It connects, can be electrical or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple
On unit.Some or all of unit therein can be selected according to the actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.Above-mentioned integrated list
The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can be stored in a computer read/write memory medium.Based on this understanding, technical scheme of the present invention is substantially
The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words
It embodies, which is stored in a storage medium, including some instructions are used so that a computer
Equipment (can be personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or
Part steps.And storage medium above-mentioned includes:USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited
Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic disc or CD etc. are various can to store program code
Medium.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.