CN106651972B - Binary image coding and decoding methods and devices - Google Patents

Binary image coding and decoding methods and devices Download PDF

Info

Publication number
CN106651972B
CN106651972B CN201510740338.5A CN201510740338A CN106651972B CN 106651972 B CN106651972 B CN 106651972B CN 201510740338 A CN201510740338 A CN 201510740338A CN 106651972 B CN106651972 B CN 106651972B
Authority
CN
China
Prior art keywords
coding
pixel
binary image
preset
image
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
CN201510740338.5A
Other languages
Chinese (zh)
Other versions
CN106651972A (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201510740338.5A priority Critical patent/CN106651972B/en
Publication of CN106651972A publication Critical patent/CN106651972A/en
Application granted granted Critical
Publication of CN106651972B publication Critical patent/CN106651972B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention discloses a binary image codingThe decoding method and the device relate to the technical field of image coding and decoding, wherein the coding method comprises the following steps: obtaining a binary image to be coded; according to the preset coding length L, obtaining a coding table T corresponding to the coding length L from a preset coding table databaseL(ii) a Grouping pixel points contained in a binary image to be coded according to a preset pixel point grouping sequence; calculating the pixel value of the pixel point contained in each pixel point grouping after grouping in the coding table TLAn index of the corresponding coding element; from the coding table T, according to the calculated index of the coding elementLTo obtain the grouping of each pixel point in the coding table TLThe value of the corresponding coding element in (1); and generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element. After the scheme provided by the embodiment of the invention is applied to coding the binary image, the storage space of the binary image can be reduced.

Description

Binary image coding and decoding methods and devices
Technical Field
The present invention relates to the field of image encoding and decoding technologies, and in particular, to a binary image encoding and decoding method and apparatus.
Background
In recent years, with the rapid development of computer technology, computer vision is more and more widely applied, and common computer vision application generally relates to character recognition technology, and in order to improve the accuracy of character recognition, a large number of binary image samples are generally required to be used for training a classifier for character recognition.
Further, the binary image as the sample is usually stored in a common image format such as BMP, and as the number of sample images increases, the number of binary image samples may reach tens of thousands, and the storage space occupied by the tens of thousands of binary image samples is very large, which is inconvenient for the user to use.
Disclosure of Invention
The embodiment of the invention discloses a binary image coding and decoding method and a binary image coding and decoding device, which are used for reducing the storage space occupied by a binary image.
In order to achieve the above object, an embodiment of the present invention discloses a binary image coding method, including:
obtaining a binary image to be coded;
according to a predetermined codeLength L, and obtaining a code table T corresponding to the code length L from a preset code table databaseLWherein the coding table TLFor recording the correspondence between the index of the coding element and the value of the coding element, said coding table TLIn (1) contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
grouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence, wherein the number of the pixel points contained in each pixel point group after grouping is the same and is not greater than the coding length L;
calculating the pixel value of the pixel point contained in each pixel point group after grouping in the coding table TLAn index of the corresponding coding element;
from the coding table T according to the calculated index of the coding elementLTo obtain the grouping of each pixel point in the coding table TLThe value of the corresponding coding element in (1);
and generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element.
In a specific implementation manner of the present invention, the coding table T calculates the pixel value of each pixel point grouping according to the pixel value of the pixel point included in each pixel point grouping after groupingLThe index of the corresponding coding element in (1), comprising:
for any pixel point group G after grouping, calculating the pixel point group G in the coding table T according to the following expressionLIndex of the corresponding coding element in (1)G
Figure BDA0000838211240000021
Wherein t represents the sequence number of the pixels in the pixel group G according to the preset pixel arrangement sequence, itAnd expressing the pixel value of the pixel with the sequence number of t in the pixel group G.
In a specific implementation manner of the present invention, the generating, according to the obtained value of the coding element, the coded data corresponding to the binary image to be coded includes:
obtaining image information of the image to be coded;
and generating coded data corresponding to the binary image to be coded according to the obtained image information and the obtained values of the coding elements and a preset information arrangement rule.
In a specific implementation manner of the present invention, after the generating, according to the image information and the obtained values of the coding elements and according to a preset information arrangement rule, the encoding data corresponding to the binary image to be encoded, the method further includes:
and storing the generated coded data to the tail of a preset image storage file, wherein the preset image storage file is used for storing the coded data corresponding to at least one binary image.
In a specific implementation manner of the present invention, the generating, according to the obtained image information and the obtained value of the coding element and according to a preset information arrangement rule, the coded data corresponding to the binary image to be coded includes:
generating coded data corresponding to the binary image to be coded according to the following information arrangement rules,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
In a specific implementation manner of the present invention, the binary image encoding method further includes:
receiving a data modification instruction aiming at the preset image storage file, wherein the data modification instruction at least comprises the following steps: the identification of the binary image to be modified, the identification of the image information to be modified and the modified value of the image information to be modified;
searching for coded data corresponding to the binary image to be modified in the preset image storage file according to the identifier of the binary image to be modified included in the data modification instruction;
and modifying the searched coded data according to the identifier of the image information to be modified and the modification value of the image information to be modified, which are included in the data modification instruction.
In order to achieve the above object, an embodiment of the present invention discloses a binary image decoding method, including:
obtaining coded data of a binary image to be decoded;
analyzing the coded data according to a preset coding length L, and further obtaining values of coding elements corresponding to each pixel point grouping of the binary image to be decoded, wherein the pixel point grouping is as follows: grouping the pixels contained in the binary image to be decoded according to a preset pixel grouping sequence, wherein the number of the pixels contained in each pixel grouping is the same and is not greater than the preset coding length L;
according to the preset coding length L, obtaining a decoding table T corresponding to the coding length L from a preset decoding table databaseL', wherein said decoding table TL' for recording the correspondence between the values of the coding elements and the indices of the coding elements, said coding table TL' therein contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
according to the value of the obtained coding element, decoding the value from the decoding table TL' obtaining each pixel grouping in the decoding table TL' index of the corresponding coding element;
obtaining the pixel value of the pixel point contained in each pixel point group according to the obtained index of the coding element;
and generating the binary image to be decoded according to the obtained pixel values.
In a specific implementation manner of the present invention, the obtaining a pixel value of a pixel included in each pixel group according to the obtained index of the coding element includes:
index for any obtained coding elementDObtaining the index dex according to the following stepsDCorresponding pixel point group GDPixel values of included pixels:
determining the indexDA binary value of (c);
according to btAnd the coding length L to obtain the pixel point group GDThe pixel value i of the pixel point with the sequence number t according to the preset pixel point arrangement sequencetWherein b istRepresenting the value of the bit marked as t from the low order to the high order in the binary value, the index
Figure BDA0000838211240000041
In a specific implementation manner of the present invention, the obtaining encoded data of a binary image to be decoded includes:
and obtaining the coded data of the binary image to be decoded from a preset image storage file according to the identifier of the binary image to be decoded, wherein the preset image storage file is used for storing the coded data corresponding to at least one binary image.
In a specific implementation manner of the present invention, the encoded data of the binary image to be decoded is: coded data arranged according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijRepresenting two valuesOne image information of the image, E, represents a data string composed of the obtained values of the coding elements.
In order to achieve the above object, an embodiment of the present invention discloses a binary image encoding device, including:
the image obtaining module is used for obtaining a binary image to be coded;
a code table obtaining module, configured to obtain, according to a preset code length L, a code table T corresponding to the code length L from a preset code table databaseLWherein the coding table TLFor recording the correspondence between the index of the coding element and the value of the coding element, said coding table TLIn (1) contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
the pixel point grouping module is used for grouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence, wherein the number of the pixel points contained in each pixel point group after grouping is the same and is not greater than the coding length L;
an index calculation module for calculating the pixel value of the pixel point contained in each pixel point group after grouping in the coding table TLAn index of the corresponding coding element;
a first value obtaining module, configured to obtain, from the coding table T, an index of the coding element according to the calculationLTo obtain the grouping of each pixel point in the coding table TLThe value of the corresponding coding element in (1);
and the coded data generating module is used for generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element.
In a specific implementation manner of the present invention, the index calculation module is specifically configured to calculate, for any pixel point group G after grouping, the pixel point group G in the coding table T according to the following expressionLIndex of the corresponding coding element in (1)G
Figure BDA0000838211240000051
Wherein t represents the sequence number of the pixels in the pixel group G according to the preset pixel arrangement sequence, itAnd expressing the pixel value of the pixel with the sequence number of t in the pixel group G.
In a specific implementation manner of the present invention, the encoded data generating module includes:
the image information obtaining submodule is used for obtaining the image information of the image to be coded;
and the coded data obtaining submodule is used for generating coded data corresponding to the binary image to be coded according to the obtained image information and the obtained values of the coding elements and a preset information arrangement rule.
In one embodiment of the present invention, the binary image encoding device further includes:
and the coded data storage module is used for storing the generated coded data to the tail of a preset image storage file after the coded data generation module generates the coded data, wherein the preset image storage file is used for storing the coded data corresponding to at least one binary image.
In a specific implementation manner of the present invention, the encoded data obtaining sub-module is specifically configured to generate encoded data corresponding to the binary image to be encoded according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
In one embodiment of the present invention, the binary image encoding device further includes:
a data modification instruction receiving module, configured to receive a data modification instruction for the preset image storage file, where the data modification instruction at least includes: the identification of the binary image to be modified, the identification of the image information to be modified and the modified value of the image information to be modified;
the coded data searching module is used for searching coded data corresponding to the binary image to be modified in the preset image storage file according to the identifier of the binary image to be modified, which is included in the data modification instruction;
and the coded data modification module is used for modifying the searched coded data according to the identifier of the image information to be modified and the modification value of the image information to be modified, which are included in the data modification instruction.
In order to achieve the above object, an embodiment of the present invention discloses a binary image decoding apparatus, including:
the coded data obtaining module is used for obtaining coded data of the binary image to be decoded;
a second value obtaining module, configured to parse the encoded data according to a preset encoding length L, and further obtain a value of an encoding element corresponding to each pixel grouping of the binary image to be decoded, where the pixel grouping is: grouping the pixels contained in the binary image to be decoded according to a preset pixel grouping sequence, wherein the number of the pixels contained in each pixel grouping is the same and is not greater than the preset coding length L;
a decoding table obtaining module, configured to obtain, according to the preset coding length L, a decoding table T corresponding to the coding length L from a preset decoding table databaseL', wherein said decoding table TL' for recording the correspondence between the values of the coding elements and the indices of the coding elements, said coding table TL' therein contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
an index obtaining module, configured to obtain a value of the coding element from the decoding table T according to the obtained valueL' obtaining each pixel grouping in the decoding table TL' index of the corresponding coding element;
the pixel value obtaining module is used for obtaining the pixel values of the pixel points contained in each pixel point group according to the obtained index of the coding element;
and the image generation module is used for generating the binary image to be decoded according to the obtained pixel values.
In a specific implementation manner of the present invention, the pixel value obtaining module is specifically configured to obtain an index of any obtained coding elementDCorresponding pixel point group GDPixel values of the contained pixels;
wherein the pixel value obtaining module comprises:
a value determination submodule for determining the indexDA binary value of (c);
a pixel value obtaining submodule for obtaining a pixel value according to btAnd the coding length L to obtain the pixel point group GDThe pixel value i of the pixel point with the sequence number t according to the preset pixel point arrangement sequencetWherein b istRepresenting the value of the bit marked as t from the low order to the high order in the binary value, the index
Figure BDA0000838211240000071
In a specific implementation manner of the present invention, the encoded data obtaining module is specifically configured to obtain, according to an identifier of a binary image to be decoded, encoded data of the binary image to be decoded from a preset image storage file, where the preset image storage file is used to store encoded data corresponding to at least one binary image.
In a specific implementation manner of the present invention, the encoded data of the binary image to be decoded is: coded data arranged according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
As can be seen from the above, in the scheme provided in the embodiment of the present invention, after the binary image to be coded is obtained, the coding table T corresponding to the coding length L is obtained from the preset coding table database according to the preset coding length LLGrouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence, and calculating the pixel point grouping in the coding table T according to the pixel value of the pixel point contained in each pixel point grouping after groupingLAccording to the calculated index of the coding element, from the coding table TLTo obtain the grouping of each pixel point in the coding table TLAnd generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element. Therefore, after the binary image to be coded is coded according to the scheme provided by the embodiment of the invention, the storage space occupied by the obtained coded data is far smaller than that occupied by the binary image to be coded.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a binary image encoding method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another binary image encoding method according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a binary image decoding method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a binary image encoding apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of another binary image encoding apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a binary image decoding device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flowchart of a binary image encoding method according to an embodiment of the present invention, where the method includes:
s101: and obtaining a binary image to be coded.
A binary image may be understood as an image that only contains black and white pixels. The pixel value of a pixel is related to the variable bit number of a variable set by a developer for representing the pixel value of the pixel.
For example, if the variable bit number of the variable used to represent the pixel value of the pixel point is 1bit, the pixel value of the black pixel point is "0" and binary representation is "0", and the pixel value of the white pixel point is "1" and binary representation is "1";
if the variable bit number of the variable for representing the pixel value of the pixel point is 8 bits, the pixel value of the black pixel point is "0", and is represented as "00000000" in binary, and the pixel value of the white pixel point is "255", and is represented as "11111111" in binary;
of course, the variable bit number of the variable used for representing the pixel value of the pixel point may be other values, and the situation is similar to the above situation, and is not listed here.
S102: according to the preset coding length L, obtaining a coding table T corresponding to the coding length L from a preset coding table databaseL
Wherein, the coding table TLFor recording the corresponding relation between the index of the coding element and the value of the coding element, the coding table contains 2LEach coding element has different values of [0,2 ]L-1]An integer within.
The preset coding length may be understood as the number of bits used to represent the variables of the coding elements in the coding table. When the binary image to be coded is coded specifically, the preset coding length can be adjusted according to the condition of the binary image to be coded, the requirement on the compression ratio and other factors. The larger the value of the preset coding length L is, the higher the compression ratio of the obtained coded data is when the scheme provided by the embodiment of the invention is applied to image coding.
In combination with a specific practical application situation, more 8-bit integer variables are used in the development process, so that L is less than or equal to 8 in a better implementation mode of the invention, further, considering that pixel grouping processing needs to be performed on pixels of a binary image to be coded in subsequent steps, a value of a preset coding length is determined according to the following expression:
W/L is an integer.
Based on the above description, a coding table T corresponding to a preset coding length L is generatedLIt is contemplated that the encoding table may be generated based on ASCII characters.
S103: and grouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence.
The preset pixel point grouping sequence may be a sequence from left to right of the pixel columns, a sequence from right to left of the pixel columns, a sequence from top to bottom of the pixel rows, a sequence from bottom to top of the pixel rows, and the like, which is not limited in the present application.
Specifically, the number of pixels included in each grouped pixel is the same and is not greater than the coding length L, and preferably, the number of pixels included in each grouped pixel is equal to the coding length L, so that the maximum compression ratio can be obtained under the condition that the coding length is fixed.
It can be understood that, when grouping the pixel points included in the binary image to be encoded, the situation that the number of the pixel points included in the last pixel point group is different from the number of the pixel points included in other pixel point groups may be encountered, at this time, any processing may not be performed on the last pixel point group, the subsequent steps are directly continued, and certainly, the pixel point alignment processing may also be performed on the last pixel point group according to the preset pixel point, for example, the preset pixel point may be the last pixel point of the binary image to be encoded, and then the pixel points supplemented in the alignment processing are discarded when decoding the encoded data, which is not limited in the present application.
S104: calculating the pixel value of the pixel point contained in each pixel point grouping after grouping in the coding table TLThe index of the corresponding coding element in (1).
In an optional implementation manner of the present invention, for any pixel point group G after grouping, the pixel point group G in the coding table T may be calculated according to the following expressionLIndex of the corresponding coding element in (1)G
Figure BDA0000838211240000101
Wherein t represents the sequence number of the pixels in the pixel group G according to the preset pixel arrangement sequence, itAnd the pixel value of the pixel with the sequence number of t in the pixel group G is represented.
it<<t represents a number itRight shift by t bits of the binary value
It is assumed that,itexpressed in 1bit, then itMay be 0 or 1, L equals 3, then
Figure BDA0000838211240000102
In addition, the above-mentioned itThe pixel value of the pixel point with the sequence number t in the pixel point group G may be a pixel value of a pixel point directly read from the binary image to be encoded, or may be a pixel value obtained by converting the pixel value of the pixel point directly read from the binary image to be encoded, for example, the pixel value of the pixel point directly read from the binary image to be encoded is 255, and the binary representation thereof is "11111111", then i is at this timetThe value can be 1, similarly, the pixel value of the pixel point directly read from the binary image to be coded is 0, the binary expression of the pixel value is 00000000, and then i is the value at the momenttMay take the value 0.
In addition, the preset pixel point arrangement sequence may be an arrangement sequence related to the preset pixel point grouping sequence, for example, the preset pixel point grouping sequence is a sequence from left to right of a pixel column and a sequence from top to bottom of a pixel row, and the preset pixel point arrangement sequence may be arranged in a sequence from left to right of the pixel points in the same pixel row, in a sequence from top to bottom of the pixel points between different pixel rows, and so on.
S105: from the coding table T, according to the calculated index of the coding elementLTo obtain the grouping of each pixel point in the coding table TLThe value of the corresponding coding element in (1).
S106: and generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element.
The encoded data generated in this step may be understood as encoded data stored in a specific file format, or may be understood as a data string that is not stored in a specific file format.
In a specific implementation manner of the present invention, when generating the encoded data, in addition to the value of the obtained encoding element, image information such as an identifier, a width, a height, a type, and whether an image is an effective image or not of a binary image to be encoded may be considered, and after adding the image information of the binary image to be encoded to the encoded data, the binary image to be encoded can be used in a later stage.
Specifically, when the encoded data corresponding to the binary image to be encoded is generated according to the obtained value of the encoding element, the image information of the image to be encoded may be obtained, and the encoded data corresponding to the binary image to be encoded is generated according to the preset information arrangement rule according to the obtained image information and the obtained value of the encoding element.
After the coded data is generated in the above way, if the coded data is not wanted to be used in later use, the identification bit indicating whether the image is a valid image in the image information can be set to be in an invalid state without deleting the coded data, and when the coded data can be used, the identification bit indicating whether the image is a valid image in the image information is set to be in a valid state, so that the management of the coded data by a user is facilitated.
Optionally, when the coded data corresponding to the binary image to be coded is generated according to the obtained image information and the obtained values of the coding elements and the preset information arrangement rule, the coded data corresponding to the binary image to be coded can be generated according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
Optionally, Id1May be the character "$", Id2The "@" character may be used, and other values are possible, but the present application is not limited thereto.
When a data string is composed according to the values of the obtained coding elements, the obtained coding elements can be simply arranged together in sequence.
For example, the encoded data generated in the above manner may be as follows:
$@ID@W@H@L@type@valid@inf:C0C1…Clen-1
wherein, C0C1…Clen-1Namely E above.
After the scheme provided by the embodiment of the invention is applied to coding the binary image, the coded data can be normally displayed to a user only after being decoded by the decoding method corresponding to the coding method provided by the embodiment of the invention, so that the coded binary image has higher safety.
As can be seen from the above, in the scheme provided in this embodiment, after obtaining the binary image to be encoded, according to the preset encoding length L, the encoding table T corresponding to the encoding length L is obtained from the preset encoding table databaseLGrouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence, and calculating the pixel point grouping in the coding table T according to the pixel value of the pixel point contained in each pixel point grouping after groupingLAccording to the calculated index of the coding element, from the coding table TLTo obtain the grouping of each pixel point in the coding table TLAnd generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element. It can be seen from the above that, a plurality of pixel points included in one pixel point group correspond to one coding element, and therefore, after the binary image to be coded is coded according to the scheme provided by this embodiment, the storage space occupied by the obtained coded data is far smaller than the storage space occupied by the binary image to be coded.
As will be appreciated by those skilled in the art, when a classifier is usually trained with a large number of binary image samples, the number of binary image samples may reach tens of thousands or even hundreds of thousands, and if these files are stored in the form of a single file, it is almost impossible for an embedded system to load these files to handle a large number of I/O operations. In view of the foregoing, in a preferred implementation manner of the present invention, referring to fig. 2, a flowchart of another binary image coding method is provided, and compared with the foregoing embodiment, in this embodiment, after generating coded data corresponding to a binary image to be coded according to a preset information arrangement rule according to image information and values of obtained coding elements, the method further includes:
s107: and storing the generated coded data to the tail of a preset image storage file.
The preset image storage file is used for storing encoded data corresponding to at least one binary image.
Based on the above situation that the generated encoded data is stored to the end of the preset image storage file, in a specific implementation manner of the present invention, the binary image encoding method may further include:
receiving a data modification instruction aiming at a preset image storage file, wherein the data modification instruction at least comprises the following steps: the identification of the binary image to be modified, the identification of the image information to be modified and the modified value of the image information to be modified;
searching coded data corresponding to the binary image to be modified in a preset image storage file according to the identifier of the binary image to be modified, which is included in the data modification instruction;
and modifying the searched coded data according to the identifier of the image information to be modified and the modification value of the image information to be modified, which are included in the data modification instruction.
As can be seen from the foregoing description, the encoded data may contain various image information, which is not listed here.
The following takes the image information as: whether an image is a valid image is explained as an example.
After receiving a data modification instruction containing an identifier of a binary image to be modified, an identifier of whether the image is an effective image and a modification value of the identifier, firstly, finding coded data of the binary image from a preset image storage file according to the identifier of the binary image to be modified, then, locating whether the image is the identifier of the effective image from the found coded data, and modifying the value of the identifier.
In practical application, if a user wants to delete the encoded data of a certain binary image from a preset image storage file, the encoded data of the binary image can be deleted by modifying the value, so that the encoded data of the binary image does not need to be deleted really.
As can be seen from the above, in the scheme provided in this embodiment, the generated encoded data is stored to the end of the preset image storage file, and the encoded data corresponding to a plurality of binary images can be stored in the preset image storage file, so that when a plurality of files need to be loaded, only the preset image storage file needs to be loaded, and obviously, multiple I/O operations are simplified into one I/O operation.
Corresponding to the binary image coding method, the embodiment of the invention also provides a binary image decoding method.
Fig. 3 is a schematic flowchart of a binary image decoding method according to an embodiment of the present invention, where the method includes:
s301: and obtaining coded data of the binary image to be decoded.
In a specific implementation manner, the encoded data of the binary image may be directly obtained from a single encoded file corresponding to the binary image to be decoded.
In another specific implementation manner, the encoded data of the binary image to be decoded may also be obtained from a preset image storage file according to the identifier of the binary image to be decoded, where the preset image storage file is used to store the encoded data corresponding to at least one binary image.
In this case, the encoded data corresponding to the plurality of binary images is stored in one file, and when the plurality of binary images need to be loaded in practical application, only one file needs to be loaded, thereby reducing the number of I/O operations.
S302: and analyzing the coded data according to the preset coding length L, and further obtaining the value of the coding element corresponding to each pixel point group of the binary image to be decoded.
The preset coding length is understood to be the number of bits of a variable representing a coding element in the coding table, and the parameter is set during the coding process. When the binary image to be decoded is specifically encoded, the preset encoding length can be adjusted according to the condition of the binary image to be decoded, requirements on compression ratio and other factors. The larger the value of the preset coding length L is, the higher the compression ratio of the obtained coded data is when the scheme provided by the embodiment of the invention is applied to image coding.
In addition, the grouping of the pixels is also performed in the encoding process, specifically, the grouping of the pixels is as follows: and according to a preset pixel point grouping sequence, grouping the pixel points contained in the binary image to be decoded, wherein the number of the pixel points contained in each pixel point grouping is the same and is not more than a preset coding length L.
S303: according to the preset coding length L, obtaining a decoding table T corresponding to the coding length L from a preset decoding table databaseL'。
Wherein, the decoding table TL' for recording the correspondence between the values of the coding elements and the indices of the coding elements, a coding table TL' therein contains 2LEach coding element has different values of [0,2 ]L-1]An integer within.
It should be noted that the decoding table in the present embodiment is a table corresponding to the encoding table in the foregoing embodiment, and the two tables are in a reciprocal relationship.
S304:According to the value of the obtained coding element, decoding the value from the decoding table TL' obtaining each pixel grouping in the decoding table TL' of the corresponding coding element.
S305: and obtaining the pixel value of the pixel point contained in each pixel point group according to the obtained index of the coding element.
In particular, in a particular implementation of the invention, the index for any one of the obtained coded elementsDThe index can be obtained as followsDCorresponding pixel point group GDPixel values of included pixels:
determining an indexDA binary value of (c);
according to btAnd the coding length L to obtain a pixel point group GDThe pixel value i of the pixel point with the sequence number t according to the preset pixel point arrangement sequencetWherein b istRepresenting the value, index, of the bit identified as t from the lower to the upper of the binary value
Figure BDA0000838211240000151
In particular, according to btObtaining the value of the pixel point group G and the coding length LDThe pixel value i of the pixel point marked as t according to the preset pixel point arrangement sequencetWhen obtaining btAfter the value of (a) is taken, firstly according to btJudging whether the pixel point marked as t is a black point or a white point if btIf the value of (b) is 0, the pixel point is represented as a black point, and if b is greater than the threshold value, the pixel point is represented as a black pointtIf the value of (1) is less than or equal to 1, the pixel point is represented as a white point, and then the pixel value of the pixel point is determined according to the color and the coding length L of the pixel point.
For example, assuming the code length L is equal to 1, then
When the pixel point is a black point, the pixel value is 0;
when the pixel point is a white point, the pixel value is 1.
Assuming that the code length L is equal to 8, then
When the pixel point is a black point, the pixel value is 0;
when the pixel point is a white point, the pixel value is 255.
Other things like this are not listed here.
It should be noted that, assuming that a binary value is "1101", values of bits from low order to high order are: 1. 0, 1, the identification of each bit from low to high can be: 0. 1, 2, and 3, it is needless to say that the initial value of the above-mentioned flag is from 0, but the initial value may be from 1, and the present application does not limit this, and the flag of each bit from lower to higher in the binary number may be simply understood as the sequence number corresponding to each bit in the binary number in the order from lower to higher.
S306: and generating a binary image to be decoded according to the obtained pixel values.
The coded data of the binary image to be decoded is as follows: coded data arranged according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
As can be seen from the above, in the scheme provided in this embodiment, the decoded encoded data is encoded data generated by grouping pixel points included in a binary image to be decoded, calculating an index of a coding element corresponding to each pixel point grouping in the coding table according to a pixel value of a pixel point included in each pixel point grouping after grouping, obtaining a value of the coding element corresponding to each pixel point grouping in the coding table from the coding table according to the calculated index of the coding element, and generating the encoded data according to the obtained value of the coding element. A plurality of pixel points included in one pixel point grouping correspond to one coding element, and therefore, the storage space occupied by the coded data decoded by applying the scheme provided by the embodiment is far smaller than the storage space occupied by the binary image to be decoded.
Corresponding to the binary image coding method, the embodiment of the invention also provides a binary image coding device.
Fig. 4 is a schematic structural diagram of a binary image encoding device according to an embodiment of the present invention, where the device includes:
an image obtaining module 401, configured to obtain a binary image to be encoded;
a code table obtaining module 402, configured to obtain, according to a preset code length L, a code table T corresponding to the code length L from a preset code table databaseLWherein the coding table TLFor recording the correspondence between the index of the coding element and the value of the coding element, said coding table TLIn (1) contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
a pixel grouping module 403, configured to group pixels included in the binary image to be encoded according to a preset pixel grouping sequence, where the number of pixels included in each pixel group after grouping is the same and is not greater than the encoding length L;
an index calculation module 404, configured to calculate, according to the pixel value of the pixel included in each grouped pixel group, the pixel value of the pixel group in the coding table TLAn index of the corresponding coding element;
a first value obtaining module 405, configured to obtain, from the coding table T, an index of a coding element according to the calculationLTo obtain the grouping of each pixel point in the coding table TLThe value of the corresponding coding element in (1);
and the coded data generating module 406 is configured to generate coded data corresponding to the binary image to be coded according to the obtained value of the coding element.
In particular, the index calculation module 404 is specifically configured to perform the index calculation forAny pixel point after grouping is grouped into G, and the pixel point group G in the coding table T is calculated according to the following expressionLIndex of the corresponding coding element in (1)G
Figure BDA0000838211240000171
Wherein t represents the sequence number of the pixels in the pixel group G according to the preset pixel arrangement sequence, itAnd expressing the pixel value of the pixel with the sequence number of t in the pixel group G.
Specifically, the encoded data generating module 406 may include:
the image information obtaining submodule is used for obtaining the image information of the image to be coded;
and the coded data obtaining submodule is used for generating coded data corresponding to the binary image to be coded according to the obtained image information and the obtained values of the coding elements and a preset information arrangement rule.
Specifically, the encoded data obtaining sub-module is specifically configured to generate encoded data corresponding to the binary image to be encoded according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
As can be seen from the above, in the scheme provided in this embodiment, after obtaining the binary image to be encoded, according to the preset encoding length L, the encoding table T corresponding to the encoding length L is obtained from the preset encoding table databaseLGrouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence, and grouping each pixel point according to each grouped pixel pointCalculating the pixel value of the pixel point contained in the pixel point group, and calculating the pixel point group in the coding table TLAccording to the calculated index of the coding element, from the coding table TLTo obtain the grouping of each pixel point in the coding table TLAnd generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element. It can be seen from the above that, a plurality of pixel points included in one pixel point group correspond to one coding element, and therefore, after the binary image to be coded is coded according to the scheme provided by this embodiment, the storage space occupied by the obtained coded data is far smaller than the storage space occupied by the binary image to be coded.
In a preferred implementation manner of the present invention, referring to fig. 5, a schematic structural diagram of another binary image coding apparatus is provided, and compared with the foregoing embodiment, in this embodiment, the apparatus further includes:
the encoded data storage module 407 is configured to store the generated encoded data to a tail of a preset image storage file after the encoded data is generated by the encoded data generation module, where the preset image storage file is used to store encoded data corresponding to at least one binary image.
Optionally, the binary image encoding device may further include:
a data modification instruction receiving module, configured to receive a data modification instruction for the preset image storage file, where the data modification instruction at least includes: the identification of the binary image to be modified, the identification of the image information to be modified and the modified value of the image information to be modified;
the coded data searching module is used for searching coded data corresponding to the binary image to be modified in the preset image storage file according to the identifier of the binary image to be modified, which is included in the data modification instruction;
and the coded data modification module is used for modifying the searched coded data according to the identifier of the image information to be modified and the modification value of the image information to be modified, which are included in the data modification instruction.
As can be seen from the above, in the scheme provided in this embodiment, the generated encoded data is stored to the end of the preset image storage file, and the encoded data corresponding to a plurality of binary images can be stored in the preset image storage file, so that when a plurality of files need to be loaded, only the preset image storage file needs to be loaded, and obviously, multiple I/O operations are simplified into one I/O operation.
Corresponding to the binary image decoding method, the embodiment of the invention also provides a binary image decoding device.
Fig. 6 is a schematic structural diagram of a binary image decoding apparatus according to an embodiment of the present invention, where the apparatus includes:
a coded data obtaining module 601, configured to obtain coded data of a binary image to be decoded;
a second value obtaining module 602, configured to parse the encoded data according to a preset encoding length L, and further obtain a value of an encoding element corresponding to each pixel grouping of the binary image to be decoded, where the pixel grouping is: grouping the pixels contained in the binary image to be decoded according to a preset pixel grouping sequence, wherein the number of the pixels contained in each pixel grouping is the same and is not greater than the preset coding length L;
a decoding table obtaining module 603, configured to obtain, according to the preset coding length L, a decoding table T corresponding to the coding length L from a preset decoding table databaseL', wherein said decoding table TL' for recording the correspondence between the values of the coding elements and the indices of the coding elements, said coding table TL' therein contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
an index obtaining module 604, configured to obtain a value of the coding element from the decoding table TL' in obtaining each pixel groupingThe decoding table TL' index of the corresponding coding element;
a pixel value obtaining module 605, configured to obtain a pixel value of a pixel included in each pixel group according to the obtained index of the coding element;
an image generating module 606, configured to generate the binary image to be decoded according to the obtained pixel values.
In particular, the pixel value obtaining module 605 is specifically configured to obtain an index of any obtained coding elementDCorresponding pixel point group GDPixel values of the contained pixels;
wherein the pixel value obtaining module comprises:
a value determination submodule for determining the indexDA binary value of (c);
a pixel value obtaining submodule for obtaining a pixel value according to btAnd the coding length L to obtain the pixel point group GDThe pixel value i of the pixel point with the sequence number t according to the preset pixel point arrangement sequencetWherein b istRepresenting the value of the bit marked as t from the low order to the high order in the binary value, the index
Figure BDA0000838211240000201
Specifically, the encoded data obtaining module 601 is specifically configured to obtain, according to an identifier of a binary image to be decoded, encoded data of the binary image to be decoded from a preset image storage file, where the preset image storage file is used to store encoded data corresponding to at least one binary image.
Specifically, the coded data of the binary image to be decoded is: coded data arranged according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2…Id2Iij…Id2Iin:E,
wherein, Id1Encoding for representing preset binary image correspondenceIdentification of the beginning of the code data, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
As can be seen from the above, in the scheme provided in this embodiment, the decoded encoded data is encoded data generated by grouping pixel points included in a binary image to be decoded, calculating an index of a coding element corresponding to each pixel point grouping in the coding table according to a pixel value of a pixel point included in each pixel point grouping after grouping, obtaining a value of the coding element corresponding to each pixel point grouping in the coding table from the coding table according to the calculated index of the coding element, and generating the encoded data according to the obtained value of the coding element. A plurality of pixel points included in one pixel point grouping correspond to one coding element, and therefore, the storage space occupied by the coded data decoded by applying the scheme provided by the embodiment is far smaller than the storage space occupied by the binary image to be decoded.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Those skilled in the art will appreciate that all or part of the steps in the above method embodiments may be implemented by a program to instruct relevant hardware to perform the steps, and the program may be stored in a computer-readable storage medium, which is referred to herein as a storage medium, such as: ROM/RAM, magnetic disk, optical disk, etc.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (20)

1. A binary image encoding method, characterized in that the method comprises:
obtaining a binary image to be coded;
according to a preset coding length L, obtaining a coding table T corresponding to the coding length L from a preset coding table databaseLWherein the coding table TLFor recording the correspondence between the index of the coding element and the value of the coding element, said coding table TLIn (1) contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
grouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence, wherein the number of the pixel points contained in each pixel point group after grouping is the same and is not greater than the coding length L;
calculating the pixel value of the pixel point contained in each pixel point group after grouping in the coding table TLAn index of the corresponding coding element;
from the coding table T according to the calculated index of the coding elementLTo obtain the grouping of each pixel point in the coding table TLThe value of the corresponding coding element in (1);
and generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element.
2. The method according to claim 1, wherein said calculating the pixel value of each pixel grouping in said coding table T according to the pixel value of the pixel contained in said groupingLThe index of the corresponding coding element in (1), comprising:
for any pixel point group G after grouping, calculating the pixel point group G in the coding table T according to the following expressionLIndex of the corresponding coding element in (1)G
Figure FDA0000838211230000011
Wherein t represents the sequence number of the pixels in the pixel group G according to the preset pixel arrangement sequence, itAnd expressing the pixel value of the pixel with the sequence number of t in the pixel group G.
3. The method according to claim 1, wherein the generating of the encoded data corresponding to the binary image to be encoded according to the obtained value of the encoding element includes:
obtaining image information of the image to be coded;
and generating coded data corresponding to the binary image to be coded according to the obtained image information and the obtained values of the coding elements and a preset information arrangement rule.
4. The method according to claim 3, wherein after generating the encoded data corresponding to the binary image to be encoded according to the image information and the obtained values of the encoding elements and a preset information arrangement rule, the method further comprises:
and storing the generated coded data to the tail of a preset image storage file, wherein the preset image storage file is used for storing the coded data corresponding to at least one binary image.
5. The method according to claim 3 or 4, wherein the generating the encoded data corresponding to the binary image to be encoded according to the obtained image information and the obtained values of the encoding elements and a preset information arrangement rule comprises:
generating coded data corresponding to the binary image to be coded according to the following information arrangement rules,
Id1Id2Ii1Id2Ii2...Id2Iij...Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
6. The method of claim 4, further comprising:
receiving a data modification instruction aiming at the preset image storage file, wherein the data modification instruction at least comprises the following steps: the identification of the binary image to be modified, the identification of the image information to be modified and the modified value of the image information to be modified;
searching for coded data corresponding to the binary image to be modified in the preset image storage file according to the identifier of the binary image to be modified included in the data modification instruction;
and modifying the searched coded data according to the identifier of the image information to be modified and the modification value of the image information to be modified, which are included in the data modification instruction.
7. A binary image decoding method, characterized in that the method comprises:
obtaining coded data of a binary image to be decoded;
analyzing the coded data according to a preset coding length L, and further obtaining values of coding elements corresponding to each pixel point grouping of the binary image to be decoded, wherein the pixel point grouping is as follows: grouping the pixels contained in the binary image to be decoded according to a preset pixel grouping sequence, wherein the number of the pixels contained in each pixel grouping is the same and is not greater than the preset coding length L;
according to the preset coding length L, obtaining a decoding table T 'corresponding to the coding length L from a preset decoding table database'LWherein, the decoding table T'LUsed for recording the corresponding relation between the value of the coding element and the index of the coding element, wherein the coding table T'LIn (1) contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
-decoding table T 'from the value of the obtained coding element'LTo obtain the T 'of each pixel point grouping in the decoding table'LAn index of the corresponding coding element;
obtaining the pixel value of the pixel point contained in each pixel point group according to the obtained index of the coding element;
and generating the binary image to be decoded according to the obtained pixel values.
8. The method according to claim 7, wherein the obtaining the pixel values of the pixels included in each pixel group according to the obtained index of the coding element comprises:
index for any obtained coding elementDObtaining the index according to the following stepsDCorresponding pixel point group GDPixel values of included pixels:
determining the indexDA binary value of (c);
according to btAnd the coding length L to obtain the pixel point group GDThe pixel value i of the pixel point with the sequence number t according to the preset pixel point arrangement sequencetWherein b istRepresenting the low to high order bits of said binary valuesThe value of the bit identified as t, the index
Figure FDA0000838211230000031
9. The method according to claim 7 or 8, wherein the obtaining encoded data of the binary image to be decoded comprises:
and obtaining the coded data of the binary image to be decoded from a preset image storage file according to the identifier of the binary image to be decoded, wherein the preset image storage file is used for storing the coded data corresponding to at least one binary image.
10. The method according to claim 9, wherein the encoded data of the binary image to be decoded is: coded data arranged according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2...Id2Iij...Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
11. A binary image encoding apparatus, characterized in that the apparatus comprises:
the image obtaining module is used for obtaining a binary image to be coded;
a code table obtaining module, configured to obtain, according to a preset code length L, a code table T corresponding to the code length L from a preset code table databaseLWherein the coding table TLFor recording the correspondence between the index of the coding element and the value of the coding element, said coding table TLIn (1) contains 2LEach code element with different valuesThe value of the element is [0,2 ]L-1]An integer within;
the pixel point grouping module is used for grouping the pixel points contained in the binary image to be coded according to a preset pixel point grouping sequence, wherein the number of the pixel points contained in each pixel point group after grouping is the same and is not greater than the coding length L;
an index calculation module for calculating the pixel value of the pixel point contained in each pixel point group after grouping in the coding table TLAn index of the corresponding coding element;
a first value obtaining module, configured to obtain, from the coding table T, an index of the coding element according to the calculationLTo obtain the grouping of each pixel point in the coding table TLThe value of the corresponding coding element in (1);
and the coded data generating module is used for generating coded data corresponding to the binary image to be coded according to the obtained value of the coding element.
12. The apparatus according to claim 11, wherein the index calculating module is specifically configured to calculate, for any pixel group G after grouping, the pixel group G in the coding table T according to the following expressionLIndex of the corresponding coding element in (1)G
Figure FDA0000838211230000041
Wherein t represents the sequence number of the pixels in the pixel group G according to the preset pixel arrangement sequence, itAnd expressing the pixel value of the pixel with the sequence number of t in the pixel group G.
13. The apparatus of claim 11, wherein the encoded data generating module comprises:
the image information obtaining submodule is used for obtaining the image information of the image to be coded;
and the coded data obtaining submodule is used for generating coded data corresponding to the binary image to be coded according to the obtained image information and the obtained values of the coding elements and a preset information arrangement rule.
14. The apparatus of claim 13, further comprising:
and the coded data storage module is used for storing the generated coded data to the tail of a preset image storage file after the coded data generation module generates the coded data, wherein the preset image storage file is used for storing the coded data corresponding to at least one binary image.
15. The apparatus according to claim 13 or 14, wherein the encoded data obtaining sub-module is specifically configured to generate the encoded data corresponding to the binary image to be encoded according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2...Id2Iij...Id2Iin:E,
wherein, Id1Indicating the beginning of the coded data corresponding to the predetermined binary image, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
16. The apparatus of claim 14, further comprising:
a data modification instruction receiving module, configured to receive a data modification instruction for the preset image storage file, where the data modification instruction at least includes: the identification of the binary image to be modified, the identification of the image information to be modified and the modified value of the image information to be modified;
the coded data searching module is used for searching coded data corresponding to the binary image to be modified in the preset image storage file according to the identifier of the binary image to be modified, which is included in the data modification instruction;
and the coded data modification module is used for modifying the searched coded data according to the identifier of the image information to be modified and the modification value of the image information to be modified, which are included in the data modification instruction.
17. A binary image decoding apparatus, characterized in that the apparatus comprises:
the coded data obtaining module is used for obtaining coded data of the binary image to be decoded;
a second value obtaining module, configured to parse the encoded data according to a preset encoding length L, and further obtain a value of an encoding element corresponding to each pixel grouping of the binary image to be decoded, where the pixel grouping is: grouping the pixels contained in the binary image to be decoded according to a preset pixel grouping sequence, wherein the number of the pixels contained in each pixel grouping is the same and is not greater than the preset coding length L;
a decoding table obtaining module, configured to obtain, according to the preset coding length L, a decoding table T 'corresponding to the coding length L from a preset decoding table database'LWherein, the decoding table T'LUsed for recording the corresponding relation between the value of the coding element and the index of the coding element, wherein the coding table T'LIn (1) contains 2LEach coding element has different values of [0,2 ]L-1]An integer within;
an index obtaining module, configured to obtain, from the decoding table T ', a value of the obtained coding element'LTo obtain the T 'of each pixel point grouping in the decoding table'LAn index of the corresponding coding element;
the pixel value obtaining module is used for obtaining the pixel values of the pixel points contained in each pixel point group according to the obtained index of the coding element;
and the image generation module is used for generating the binary image to be decoded according to the obtained pixel values.
18. The apparatus according to claim 17, wherein the pixel value obtaining module is specifically configured to obtain an index of any obtained coding elementDCorresponding pixel point group GDPixel values of the contained pixels;
wherein the pixel value obtaining module comprises:
a value determination submodule for determining the indexDA binary value of (c);
a pixel value obtaining submodule for obtaining a pixel value according to btAnd the coding length L to obtain the pixel point group GDThe pixel value i of the pixel point with the sequence number t according to the preset pixel point arrangement sequencetWherein b istRepresenting the value of the bit marked as t from the low order to the high order in the binary value, the index
Figure FDA0000838211230000061
19. The apparatus according to claim 17 or 18, wherein the encoded data obtaining module is specifically configured to obtain, according to the identifier of the binary image to be decoded, the encoded data of the binary image to be decoded from a preset image storage file, where the preset image storage file is used to store the encoded data corresponding to at least one binary image.
20. The apparatus according to claim 19, wherein the encoded data of the binary image to be decoded is: coded data arranged according to the following information arrangement rule,
Id1Id2Ii1Id2Ii2...Id2Iij...Id2Iin:E,
wherein, Id1Representing the start of encoded data corresponding to a predetermined binary imageIdentification, Id2Identification of the separation between image information representing preset binary images, IijOne image information representing a binary image, and E representing a data string composed of values of the obtained coding elements.
CN201510740338.5A 2015-11-03 2015-11-03 Binary image coding and decoding methods and devices Active CN106651972B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510740338.5A CN106651972B (en) 2015-11-03 2015-11-03 Binary image coding and decoding methods and devices

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510740338.5A CN106651972B (en) 2015-11-03 2015-11-03 Binary image coding and decoding methods and devices

Publications (2)

Publication Number Publication Date
CN106651972A CN106651972A (en) 2017-05-10
CN106651972B true CN106651972B (en) 2020-03-27

Family

ID=58851010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510740338.5A Active CN106651972B (en) 2015-11-03 2015-11-03 Binary image coding and decoding methods and devices

Country Status (1)

Country Link
CN (1) CN106651972B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112672132B (en) * 2018-09-30 2023-12-26 Oppo广东移动通信有限公司 Data processing method and device, electronic equipment and storage medium
CN110288673B (en) * 2019-05-08 2023-01-31 深圳大学 Method and system for mapping instruction sequence into image
CN110264533A (en) * 2019-06-25 2019-09-20 北京慧眼智行科技有限公司 A kind of data transmission method, device and electronic equipment
CN112866181B (en) * 2019-11-28 2023-05-26 上海商汤智能科技有限公司 Data decoding device, accelerator, and system on chip
CN111491169B (en) * 2020-04-22 2022-12-09 湖南国科微电子股份有限公司 Digital image compression method, device, equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0395394A2 (en) * 1989-04-26 1990-10-31 Canon Kabushiki Kaisha Image encoding method
CN102256124A (en) * 2011-06-30 2011-11-23 杭州海康威视软件有限公司 Image layered coding method and device
CN104378644A (en) * 2013-08-16 2015-02-25 上海天荷电子信息有限公司 Fixed-width variable-length pixel sample value string matching strengthened image compression method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0395394A2 (en) * 1989-04-26 1990-10-31 Canon Kabushiki Kaisha Image encoding method
CN102256124A (en) * 2011-06-30 2011-11-23 杭州海康威视软件有限公司 Image layered coding method and device
CN104378644A (en) * 2013-08-16 2015-02-25 上海天荷电子信息有限公司 Fixed-width variable-length pixel sample value string matching strengthened image compression method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
数据多次分组的图像无损压缩算法;高健 等;《计算机系统应用》;20101231;第19卷(第12期);第64-68页 *

Also Published As

Publication number Publication date
CN106651972A (en) 2017-05-10

Similar Documents

Publication Publication Date Title
CN106651972B (en) Binary image coding and decoding methods and devices
US8942487B1 (en) Similar image selection
US10049291B2 (en) Image-processing apparatus, image-processing method, and computer program product
CN110751224B (en) Training method of video classification model, video classification method, device and equipment
RU2011123115A (en) METHOD AND DEVICE FOR PRESENTING AND IDENTIFYING SIGN CHARACTERS USING A COMPRESSED HISTOGRAM OF GRADIENTS
CN110781960B (en) Training method, classification method, device and equipment of video classification model
CN111382298B (en) Image retrieval method and device based on picture content and electronic equipment
CN113254654B (en) Model training method, text recognition method, device, equipment and medium
US20150261990A1 (en) Method and apparatus for compressing dna data based on binary image
CN110502664A (en) Video tab indexes base establishing method, video tab generation method and device
US20190258619A1 (en) Data compression method, data compression device, computer program, and database system
CN115630343B (en) Electronic document information processing method, device and equipment
CN111901594B (en) Visual analysis task-oriented image coding method, electronic device and medium
JP6070568B2 (en) Feature coding apparatus, feature coding method, and program
CN110662080B (en) Machine-oriented universal coding method
JP2006351001A (en) Content characteristic quantity extraction method and device, and content identity determination method and device
CN114022887A (en) Text recognition model training and text recognition method and device, and electronic equipment
CN107463676B (en) Text data storage method and device
US11360940B2 (en) Method and apparatus for biological sequence processing fastq files comprising lossless compression and decompression
CN113095058B (en) Method and device for processing page turning of streaming document, electronic equipment and storage medium
CN114611501A (en) Rarely-used word detection method, device, equipment and storage medium
CN113595557B (en) Data processing method and device
CN117272933B (en) Concrete pavement report data storage method
US10084477B2 (en) Method and apparatus for adaptive data compression
US9615111B2 (en) Complexity-adaptive compression of color images using binary arithmetic coding

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