CN106991348B - A kind of bar code decoding method and device - Google Patents

A kind of bar code decoding method and device Download PDF

Info

Publication number
CN106991348B
CN106991348B CN201710170763.4A CN201710170763A CN106991348B CN 106991348 B CN106991348 B CN 106991348B CN 201710170763 A CN201710170763 A CN 201710170763A CN 106991348 B CN106991348 B CN 106991348B
Authority
CN
China
Prior art keywords
character
decoded
boundary point
module
end boundary
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
CN201710170763.4A
Other languages
Chinese (zh)
Other versions
CN106991348A (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.)
Zhejiang Huaray Technology Co Ltd
Original Assignee
Zhejiang Huaray 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 Zhejiang Huaray Technology Co Ltd filed Critical Zhejiang Huaray Technology Co Ltd
Priority to CN201710170763.4A priority Critical patent/CN106991348B/en
Publication of CN106991348A publication Critical patent/CN106991348A/en
Application granted granted Critical
Publication of CN106991348B publication Critical patent/CN106991348B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10544Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum
    • G06K7/10821Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices

Abstract

The embodiment of the invention discloses a kind of bar code decoding method and device, to when solving that bar code border is unintelligible in the prior art, the width and molded breadth of item sky have deviation, cause the problem of decoding inaccuracy.This method comprises: determining the candidate end boundary point of character to be decoded according to the quantity of the boundary point of the corresponding decoding character of type of bar code and the first object end boundary point of the previous character of character to be decoded;According to first object end boundary point the first width value corresponding with candidate end boundary point range and the second width value of preservation, the second target end boundary point of character to be decoded is determined;According to the grayscale information in first object end boundary point and the second target end boundary point range, to the Character decoder to be decoded.So as to avoid to a certain extent because bar code border it is unintelligible caused by the item sky width inaccuracy of decoding character that determines, improve decoded accuracy to a certain extent.

Description

A kind of bar code decoding method and device
Technical field
The present invention relates to technical field of image processing, in particular to a kind of bar code decoding method and device.
Background technique
Barcode technology is the door code to grow up in computer technology and Information Technology Foundation, printing, identification, number According to the emerging technology adopted and handled.The advantages that barcode technology is quick, accurate, reliable and at low cost due to its identification, It is widely used in the fields such as business, taking care of books, storage, post and telecommunications, traffic and Industry Control, and certainly will gradually rising Great effect is played in " Internet of Things " application.
In the bar code detection scheme of view-based access control model system, it is broadly divided into Bar code positioning and bar code decoding.In bar code decoding mistake How Cheng Zhong improves decoded accuracy rate, is always an important research topic.Existing bar code decoding method specifically includes that 1, based on the template matching algorithm of bar width: determining the width of item sky by the number of pixel contained in record strip or sky Determining width is carried out matching with the template of normal width and determines corresponding code value by degree.2, average distance method: positioning shaping Show that the overall width of the bar code finds out unimodular according to the total template length of bar code and the overall width behind the initial position of code The pixel number of plate, and then each empty width in bar code is measured, the template of determining width and normal width is carried out Corresponding code value is determined in matching.3, similar back gauge method: the sum by calculating adjacent strip sky width, with standard solution code mask The sum of adjacent strip sky width is matched to decode.
It is larger to the boundary point dependence of item sky when being decoded using above-mentioned each method to bar code, but because printing Equal other problems, when bar code border is unintelligible, the width and molded breadth of item sky have deviation, and the solution code mask selected in this way will Inaccuracy, to cause decoding inaccuracy.
Summary of the invention
The present invention provides a kind of bar code decoding method and device, to when solving that bar code border is unintelligible in the prior art, The width and molded breadth of item sky have deviation, the solution code mask inaccuracy of selection, to cause the problem of decoding inaccuracy.
In order to achieve the above objectives, the embodiment of the invention discloses a kind of bar code decoding methods, which comprises
For character to be decoded in bar code, according to the number of the boundary point of the corresponding decoding character of the type of the bar code The previous character of amount and the character to be decoded is located at the first object end boundary point on horizontal scanning line, described in determination Character to be decoded is located at the candidate end boundary point on the horizontal scanning line;
According to the first object end boundary point the first width value corresponding with the candidate end boundary point range with And the second width value of the decoding character saved, determine the second target knot that the character to be decoded is located on the horizontal scanning line Beam boundary point;
According to first object end boundary point described on the horizontal scanning line and the second target end boundary point range Interior grayscale information, to the Character decoder to be decoded.
Further, the method also includes:
According to the of the first object end boundary point of the previous character of the character to be decoded and the character to be decoded The corresponding third width value of two target end boundary point ranges is updated the second width value of the decoding character of preservation.
Further, described corresponding with the candidate end boundary point range according to the first object end boundary point Second width value of the first width value and the decoding character of preservation, determines that the character to be decoded is located on the horizontal scanning line The second target end boundary point include:
Judge corresponding first width value of the character to be decoded and the absolute value of the difference of the second width value saved is It is no to be less than given threshold;
If so, candidate's end boundary point character to be decoded as this to be located to the second mesh on the horizontal scanning line Mark end boundary point;
If not, identification be located at horizontal scanning line on each boundary point and the first object end boundary point between away from From corresponding boundary point, it is to be decoded to be determined as this when by the distance with the absolute value of the difference minimum of second width value Character is located at the second target end boundary point on the horizontal scanning line.
Further, described according to first object end boundary point described on the horizontal scanning line and the second target knot Grayscale information in the point range of beam boundary includes: to the Character decoder to be decoded
The quantity for the module for including according to the corresponding decoding character of the type of the bar code and the first object terminate Boundary point third width value corresponding with the second target end boundary point range, determines each module position of the character to be decoded In each first boundary point on the horizontal scanning line;
According to grayscale information of each module of the character to be decoded within the scope of corresponding first boundary point and to be selected First binary coded data of the solution code mask selected, determines the target decoder template of the character to be decoded;
According to the target decoder template of the determining character to be decoded, to the Character decoder to be decoded.
Further, the ash according to each module of the character to be decoded within the scope of corresponding first boundary point The first binary coded data for spending information and solution code mask to be selected, determines the target decoder template of the character to be decoded Include:
According to grayscale information of each module of the character to be decoded within the scope of corresponding first boundary point, wait select Solution code mask the first binary coded data and opposed second binary system of first binary coded data compile Code data, determine the target decoder template of the character to be decoded, wherein second binary coded data and described first Corresponding element in binary coded data is different.
Further, the ash according to each module of the character to be decoded within the scope of corresponding first boundary point It is opposed to spend information, the first binary coded data of solution code mask to be selected and first binary coded data Second binary coded data determines that the target decoder template of the character to be decoded includes:
The first binary system according to the grayscale information of each module of the character to be decoded, with solution code mask to be selected First sum of products of coded data determines the first average gray value of the character to be decoded;
According to the second sum of products of the grayscale information of each module and second binary coded data, determining should Second average gray value of character to be decoded;
Corresponding decoding to be selected when by the first average gray value with the absolute value of the difference maximum of the second average gray value Template is determined as the target decoder template of the character to be decoded.
Further, it is determined that grayscale information of each module of character to be decoded within the scope of corresponding first boundary point Include:
For each module of the character to be decoded, determine that the module is located on the horizontal scanning line corresponding first boundary Each pixel in point range;
The gray value for identifying each pixel in the module includes according in the gray value of each pixel and the module Pixel number, determine the grayscale information of the module.
The embodiment of the present invention discloses a kind of bar code decoding device, and described device includes:
Determining module, for being directed to character to be decoded in bar code, according to the corresponding decoding character of the type of the bar code The quantity of boundary point and the previous character of the character to be decoded be located at the first object end boundary on horizontal scanning line Point determines that the character to be decoded is located at the candidate end boundary point on the horizontal scanning line;
The determining module is also used to according to the first object end boundary point and the candidate end boundary point range Second width value of corresponding first width value and the decoding character of preservation, determines that the character to be decoded is located at the row and sweeps Retouch the second target end boundary point on line;
Decoder module, for according to first object end boundary point described on the horizontal scanning line and the second target knot Grayscale information in the point range of beam boundary, to the Character decoder to be decoded.
Further, described device further include:
Update module, for according to the first object end boundary point of the previous character of the character to be decoded and should be wait solve The corresponding third width value of the second target end boundary point range of the character of code is wide to the second of the decoding character of preservation Angle value is updated.
Further, the determining module, specifically for judging corresponding first width value of the character to be decoded and protecting Whether the absolute value of the difference for the second width value deposited is less than given threshold;If so, using candidate's end boundary point as this Character to be decoded is located at the second target end boundary point on the horizontal scanning line;If not, identification is located on horizontal scanning line Each boundary point and the distance between the first object end boundary point, by the distance and the difference of second width value Corresponding boundary point when absolute value minimum, being determined as the second target that the character to be decoded is located on the horizontal scanning line terminates Boundary point.
Further, the decoder module includes specifically for the corresponding decoding character of the type according to the bar code The quantity of module and first object end boundary point third width value corresponding with the second target end boundary point range, Determine that each module of the character to be decoded is located at each first boundary point on the horizontal scanning line;It is to be decoded according to this The one or two of grayscale information of each module of character within the scope of corresponding first boundary point and solution code mask to be selected into Coded data processed determines the target decoder template of the character to be decoded;According to the target solution of the determining character to be decoded Code mask, to the Character decoder to be decoded.
Further, the decoder module, specifically for each module according to the character to be decoded corresponding Grayscale information in one boundary point range, the first binary coded data of solution code mask to be selected and the described 1st into Opposed second binary coded data of coded data processed, determines the target decoder template of the character to be decoded, wherein institute It is different from the corresponding element in first binary coded data to state the second binary coded data.
Further, the decoder module, specifically for the grayscale information according to each module of the character to be decoded, With the first sum of products of the first binary coded data of solution code mask to be selected, determine that the first of the character to be decoded is flat Equal gray value;According to the second sum of products of the grayscale information of each module and second binary coded data, determine Second average gray value of the character to be decoded;Most by the absolute value of the difference of the first average gray value and the second average gray value Corresponding solution code mask to be selected, is determined as the target decoder template of the character to be decoded when big.
Further, the decoder module determines the module specifically for being directed to each module of the character to be decoded Each pixel within the scope of first boundary point is corresponded on the horizontal scanning line;Identify each pixel in the module Gray value determines the gray scale letter of the module according to the number for the pixel for including in the gray value of each pixel and the module Breath.
The embodiment of the invention discloses a kind of bar code decoding method and devices, which comprises in bar code wait solve The character of code, according to the quantity of the boundary point of the corresponding decoding character of the type of the bar code and the character to be decoded Previous character be located at the first object end boundary point on horizontal scanning line, determine that the character to be decoded is located at the row and sweeps Retouch the candidate end boundary point on line;It is corresponding with the candidate end boundary point range according to the first object end boundary point The first width value and preservation decoding character the second width value, determine that the character to be decoded is located at the horizontal scanning line On the second target end boundary point;According to first object end boundary point described on the horizontal scanning line and second target Grayscale information in end boundary point range, to the Character decoder to be decoded.Due in embodiments of the present invention, according to described The quantity and first object end boundary point of the boundary point of the corresponding decoding character of the type of bar code, determine candidate's end boundary Point, according to the first object end boundary point the first width value corresponding with candidate's end boundary point range and preservation Decoding character the second width value, determine the second target end boundary that the character to be decoded is located on the horizontal scanning line Point.So as to be avoided to a certain extent because the item sky width of decoding character that determines is inaccurate caused by bar code border is unintelligible Really, decoded accuracy is improved to a certain extent.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of bar code decoding process schematic provided in an embodiment of the present invention;
Fig. 2 is a kind of bar code decoding process schematic provided in an embodiment of the present invention;
Fig. 3 is the bar code that a seed type provided in an embodiment of the present invention is EAN-13;
Fig. 4 is a kind of bar code decoding structure drawing of device provided in an embodiment of the present invention.
Specific embodiment
In order to make bar code when obscure boundary is clear, the accuracy of bar code decoding is improved, the embodiment of the invention provides one kind Bar code decoding method and device.
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Embodiment 1:
Fig. 1 be a kind of bar code decoding process schematic provided in an embodiment of the present invention, the process the following steps are included:
S101: for character to be decoded in bar code, according to the boundary point of the corresponding decoding character of the type of the bar code Quantity and the previous character of the character to be decoded be located at the first object end boundary point on horizontal scanning line, determine The character to be decoded is located at the candidate end boundary point on the horizontal scanning line.
Bar code decoding method provided in an embodiment of the present invention can be applied to electronic equipment, which can be hand-held The bar code readers such as formula barcode reader, fixed barcode reader are also possible to the mobile phone with bar code decoding function, put down The terminal devices such as plate computer.
Electronic equipment can identify character to be decoded in bar code, and after an each pair of Character decoder to be decoded, Will record the first object end boundary point of the decoded character, so as to according to the first object end boundary point to next A Character decoder to be decoded.When, there are when character to be decoded, the bar code is referred to as bar code to be decoded in bar code. For each character to be decoded, the previous character of the character to be decoded is had recorded in electronic equipment is located at horizontal scanning line On first object end boundary point.
The quantity of the corresponding boundary point of decoding character of each type of bar code, the electronic equipment are preserved in electronic equipment The type that can determine bar code to be decoded identifies described to be decoded according to the type of determining bar code to be decoded The quantity of the boundary point of the corresponding decoding character of bar code.The process of the type of determination bar code to be decoded belongs to existing skill Art, in embodiments of the present invention without repeating.
Electronic equipment is according to the quantity of the boundary point of the corresponding decoding character of the type of bar code to be decoded, and record The first object end boundary point of the previous character of the character to be decoded determines that the character to be decoded is located at the row When candidate end boundary point in scan line, the specific can be that, electronic equipment can identify each boundary on horizontal scanning line Point, for character to be decoded, by the first object end boundary o'clock of the previous character of the character to be decoded as first Boundary point on the direction along bar code decoding, determines that n-th boundary point, the N are described since first boundary point The quantity of the boundary point of the corresponding decoding character of the type of bar code will determine n-th boundary point as the character to be decoded Candidate end boundary point on the horizontal scanning line.
When the character to be decoded is first decoding character in bar code, the previous character of the character to be decoded For bebinning character, electronic equipment can orient the position of bebinning character, then the first object for having recorded bebinning character terminates side Boundary's point.The process for positioning the position of bebinning character belongs to the prior art, in embodiments of the present invention without repeating.
Such as the quantity of the boundary point of the corresponding decoding character of type of the bar code is 4, i.e. N=4, this can be waited solving The first object end boundary o'clock of the previous character of the character of code is as first boundary point, since first boundary point, In Along on the direction of bar code decoding, the 4th boundary point is identified, the 4th boundary point is that the character to be decoded is located at Candidate end boundary point on the horizontal scanning line.
S102: according to the first object end boundary point the first width corresponding with candidate's end boundary point range Second width value of value and the decoding character saved, determines the second mesh that the character to be decoded is located on the horizontal scanning line Mark end boundary point.
Electronic equipment, can be by the first of the decoded character after the Character decoder to be decoded to each of bar code Target start boundary point of the target end boundary point as next character to be decoded, the then target of the character to be decoded Start boundary point is the first object end boundary point of the previous character of character to be decoded.
After determining the candidate end boundary point and target start boundary point of the character to be decoded, it can determine The target start boundary point of the character to be decoded the first width value corresponding with candidate end boundary point range, that is, institute State first object end boundary point the first width value corresponding with candidate's end boundary point range.
The second width value that decoding character is preserved in electronic equipment is determining that the character to be decoded is located at the row When the second target end boundary point in scan line, it can be determined according to first width value and second width value, tool Can be for body judges whether first width value is identical as the second width value, can be by the candidate knot if identical The beam boundary point character to be decoded as this is located at the second target end boundary point on the horizontal scanning line.If it is different, can Using the average value of the first width value and the second width value as target width value, is determined each boundary point on horizontal scanning line with The target start boundary point of character to be decoded the distance between, that is, determine horizontal scanning line on each boundary point with to The distance between first object end boundary point of the previous character of decoded character.By the difference of the distance and target width value Corresponding boundary point is determined as the second target that the character to be decoded is located on the horizontal scanning line when absolute value minimum of value End boundary point.
Second width value of the preservation can be the template of the corresponding decoding character of type of the bar code to be decoded Width value, because being that the item in the image according to the bar code to be decoded of acquisition is empty when treating decoded bar code and being decoded Width is decoded, is not the practical item sky width for the bar code being printed on object, so the template width value is also image pair The template width value answered.When determining the corresponding template width value of image, the banner word of the bar code according to the type can be The ratio and bebinning character and/or termination in image of the width value of the width value and decoding character of symbol and/or final character What the width value of character determined.
S103: according to first object end boundary point described on the horizontal scanning line and the second target end boundary point Grayscale information in range, to the Character decoder to be decoded.
Because the previous character of character to be decoded be located at the first object end boundary point on horizontal scanning line be it is described to Decoded character is located at the target start boundary point on horizontal scanning line, when the target start boundary for defining character to be decoded It, can be according to the target start boundary point and target end boundary point of the character to be decoded after point and target end boundary point Grayscale information in range, to the Character decoder to be decoded, that is, according to word to be decoded on the horizontal scanning line determined In the first object end boundary point of previous character and the second target end boundary point range of the character to be decoded of symbol Grayscale information, to the Character decoder to be decoded.
Due in embodiments of the present invention, according to the quantity of the boundary point of the corresponding decoding character of the type of the bar code and First object end boundary point determines candidate's end boundary point, according to the first object end boundary point and the candidate knot Second width value of corresponding first width value of beam boundary point range and the decoding character of preservation, determines the character to be decoded The second target end boundary point on the horizontal scanning line.So as to be avoided to a certain extent because bar code border is unclear The item sky width inaccuracy of the decoding character determined caused by clear, improves decoded accuracy to a certain extent.
Embodiment 2:
When occurring, when obscure boundary is clear and photo angle deviation is larger, each of bar code character to be decoded is corresponding Width value width value corresponding with the previous character of itself is closely related, in order to further increase decoded accuracy.Above-mentioned On the basis of each embodiment, in embodiments of the present invention, the method also includes:
According to the of the first object end boundary point of the previous character of the character to be decoded and the character to be decoded The corresponding third width value of two target end boundary point ranges is updated the second width value of the decoding character of preservation.
In embodiments of the present invention, after determining the target end boundary point of each character to be decoded, it can be root Terminate according to the first object end boundary point of previous character and the second target of the character to be decoded of the character to be decoded Point range corresponding third width value in boundary is updated the second width value of the decoding character of preservation.By the third Width value is as updated second width value, in the second target end boundary point for determining next character to be decoded, It can be determined according to updated second width value.Electronic equipment often determines that second target an of character to be decoded terminates After boundary point, can according to the second target end boundary point determined to preservation decoding character the second width value into Row updates.
Embodiment 3:
In order to further increase decoded accuracy, on the basis of the various embodiments described above, in embodiments of the present invention,
It is described according to the first object end boundary point the first width corresponding with the candidate end boundary point range Second width value of value and the decoding character saved, determines the second mesh that the character to be decoded is located on the horizontal scanning line Marking end boundary point includes:
Judge corresponding first width value of the character to be decoded and the absolute value of the difference of the second width value saved is It is no to be less than given threshold;
If so, candidate's end boundary point character to be decoded as this to be located to the second mesh on the horizontal scanning line Mark end boundary point;
If not, identification be located at horizontal scanning line on each boundary point and the first object end boundary point between away from From corresponding boundary point, it is to be decoded to be determined as this when by the distance with the absolute value of the difference minimum of second width value Character is located at the second target end boundary point on the horizontal scanning line.
In embodiments of the present invention, threshold value is preserved in electronic equipment, in the prev word according to the character to be decoded The first object end boundary point of symbol and corresponding first width value of the candidate end boundary point range of the character to be decoded And the second width value of the decoding character saved, determine the second target that the character to be decoded is located on the horizontal scanning line When end boundary point, the difference for determining the character to be decoded corresponding first width value and the second width value saved can be Absolute value, judge whether the absolute value is less than the threshold value of setting, if it is, using candidate's end boundary point as should be to Decoded character is located at the second target end boundary point on the horizontal scanning line, is located at row scanning if it is not, then determining The distance between the first object end boundary point of previous character of each boundary point and the character to be decoded on line, determines The absolute value of the distance and the difference of second width value, corresponding boundary point when by the absolute value minimum of the difference, It is determined as the second target end boundary point that the character to be decoded is located on the horizontal scanning line.
The threshold value that electronic equipment saves can be a definite value, be also possible to after often decoding a character, to the threshold value It is updated, when being updated, can be the second target according to first object end boundary point and the character to be decoded The corresponding third width value of end boundary point range updates, such as can be the third width value multiplied by preset ratio system It is middle as the threshold value after number.The proportionality coefficient can be 0.1 or 0.2.
Embodiment 4:
In order to further increase decoded accuracy, on the basis of the various embodiments described above, in embodiments of the present invention, institute It states according to the ash in first object end boundary point described on the horizontal scanning line and the second target end boundary point range Information is spent, includes: to the Character decoder to be decoded
The quantity for the module for including according to the corresponding decoding character of the type of the bar code and the first object terminate Boundary point third width value corresponding with the second target end boundary point range, determines each module position of the character to be decoded In each first boundary point on the horizontal scanning line;
According to grayscale information of each module of the character to be decoded within the scope of corresponding first boundary point and to be selected First binary coded data of the solution code mask selected, determines the target decoder template of the character to be decoded;
According to the target decoder template of the determining character to be decoded, to the Character decoder to be decoded.
In the present invention is implemented, the module that the corresponding decoding character of each type of bar code includes is preserved in electronic equipment Quantity.It, can be according to the previous of character to be decoded after determining the second target end boundary point of character to be decoded The first object end boundary point of character and the second target end boundary point range range of the character to be decoded are corresponding Third width value, determine that each module of the character to be decoded is located at each first boundary point on the horizontal scanning line. The first object end boundary point of the previous character of the character to be decoded is that the target of the character to be decoded starts Boundary point.
The specific can be that by the ratio of the third width value and the quantity of the module to be determined as this to be decoded The width value of each module in character determines that each module each of is located on the horizontal scanning line according to the width value One boundary point.The first boundary point is the start boundary point and end boundary point of the module.By the mesh of the character to be decoded Mark start boundary point is determined as the start boundary point of first module in the character to be decoded, is determined according to the width value The end boundary point of first module, the start boundary point by the end boundary o'clock of first module as second module, The end boundary point that second module is determined according to the width value, using the end boundary of second module point as third mould It is every on the horizontal scanning line successively to determine that each module in the character to be decoded is located at for the start boundary point ... ... of block A first boundary point.
The first binary system of the solution code mask of each decoding character in each type of bar code is preserved in electronic equipment Coded data, each element in the first binary coded data of the solution code mask represent the module category an of normal width In item or sky, the element solved in the first binary coded data of code mask is " 0 " and " 1 ", wherein " 0 " represents sky, " 1 " generation Table item.For example, including two items, two skies in the solution code mask, first item includes two standard modules, and first aerial It include two standard modules in second item comprising two standard modules, second includes a standard module, the decoding in the air First binary coded data of template is 1100110.
First binary system of the number for the module for including in the decoding character of each type of bar code and the solution code mask The number of element in coded data is identical.
After determining each first boundary point that each module in character to be decoded is located on the horizontal scanning line, Electronic equipment can according to grayscale information of each module of character to be decoded within the scope of corresponding first boundary point and to First binary coded data of the solution code mask of selection, determines the target decoder template of character to be decoded.The described module It is determined in the grayscale information within the scope of corresponding first boundary point according to the gray value of the pixel in the module, such as should The grayscale information of module can be 0, can be 255, be also possible to 200.
The specific can be that by the grayscale information of each module in character to be decoded and being somebody's turn to do solution code mask to be selected The first binary coded data in corresponding element product sum, determine the first gray value of the character to be decoded, will First gray value corresponding solution code mask to be selected when being minimum, is determined as the target decoder mould of the character to be decoded Plate.Because if the solution code mask to be selected is target decoder template, then the first binary system of the target decoder template is compiled Element " 0 " in code data represents the element respective modules and belongs to aerial module, and the grayscale information of the module is " 255 ", mesh Element " 1 " in first binary coded data of mark solution code mask represents the module that the element respective modules belong in item, should The grayscale information of module is " 0 ", and element " 1 " is multiplied with grayscale information 0, and element " 0 " is multiplied with grayscale information 255, then decoded word The grayscale information of each module in symbol and the corresponding element in the first binary coded data of solution code mask that should be to be selected Product and be 0, but since the grayscale information of module may not be 0 or 255, then the first gray value is not also 0, but is answered This is closest to 0, so corresponding solution code mask to be selected when by the first gray value minimum, is determined as the character to be decoded Target decoder template.
After determining the target decoder template of the character to be decoded, so that it may according to the determining character to be decoded Target decoder template, which is decoded.The target decoder according to the determining character to be decoded Template, the process being decoded to the character to be decoded belong to the prior art, in embodiments of the present invention to the process not into Row repeats.
Due in embodiments of the present invention according to the grayscale information of each module of the character to be decoded and solution to be selected Each element of first binary coded data of code mask, the target decoder template of the character to be decoded determined, one Determine to improve decoded accuracy in degree.
Embodiment 5:
In order to further increase decoded accuracy, on the basis of the various embodiments described above, in embodiments of the present invention, institute State the grayscale information according to each module of the character to be decoded within the scope of corresponding first boundary point and solution to be selected First binary coded data of code mask determines that the target decoder template of the character to be decoded includes:
According to grayscale information of each module of the character to be decoded within the scope of corresponding first boundary point, wait select Solution code mask the first binary coded data and opposed second binary system of first binary coded data compile Code data, determine the target decoder template of the character to be decoded, wherein second binary coded data and described first Corresponding element in binary coded data is different.
In embodiments of the present invention, in each module according to the character to be decoded in corresponding first boundary point range First binary coded data of interior grayscale information and solution code mask to be selected, determines the target solution of the character to be decoded When code mask, the gray scale letter according to each module of the character to be decoded within the scope of corresponding first boundary point can be The first binary coded data and first binary coded data opposed second of breath, solution code mask to be selected Binary coded data determines the target decoder template of the character to be decoded, wherein the second binary coded data with it is described Corresponding element in first binary coded data is different.For example, in the solution code mask include two items, two skies, first Item includes two standard modules, and first includes two standard modules in the air, includes two standard modules in second item, and second A include a standard module in the air, and the first binary coded data of the solution code mask is 1100110, first binary system Opposed second binary coded data of coded data is 0011001.
The specific can be that by the grayscale information of each module of the character to be decoded and solution code mask to be selected Corresponding element in first binary coded data is multiplied and is added, and obtains the first sum of products, by first sum of products and first The ratio of the number of element " 1 " in binary coded data is determined as the actual average gray value of the character to be decoded, sentences Whether the actual average gray value that breaks is less than the first gray value threshold value pre-saved, if it is, by each module Opposed second binary coded data of the first binary coded data of grayscale information and the solution code mask to be selected In corresponding element multiplication and addition, obtain the second sum of products, will be in second sum of products and the second binary coded data The ratio of number of element " 1 " be determined as the theoretical average gray value of the character to be decoded, judge the theory average gray Whether value is greater than the second gray value threshold value pre-saved, if it is, the solution code mask is determined as target decoder template. Wherein, the second binary coded data is different from the corresponding element in first binary coded data, first gray scale It is worth threshold value less than the second gray value threshold value.
Because if the solution code mask to be selected be target decoder template, then the one or two of the target decoder template into Element " 0 " in coded data processed represents the grayscale information of the element respective modules as " 255 ", and the 1st of target decoder template the Element " 1 " in scale coding data represents the grayscale information of the element respective modules as " 0 ", element " 1 " and 0 phase of grayscale information Multiply, element " 0 " is multiplied with grayscale information 255, then the grayscale information of each module in the character to be decoded with should wait select Solution code mask the first binary coded data in corresponding element the first sum of products be 0, then actual average gray value be 0.When by the first binary coded data phase of the grayscale information of each module of the character to be decoded and target decoder template Opposition the second binary coded data in corresponding element be multiplied when, element " 1 " is multiplied with grayscale information 255, element " 0 " and Grayscale information 0 is multiplied, and corresponding second sum of products is the largest, and theoretical average gray value is 255.
But since bar code border is unintelligible, the width and molded breadth of item sky have deviation, are determining the character to be decoded Each module grayscale information when it is possible that mistake, will lead to actual average gray value in this way greater than 0, then it is theoretical flat Equal gray value is less than 255, in order to determine more accurate target decoder template, then can protect by actual average gray value and in advance The the first gray value threshold value deposited is compared, such as less than described first gray threshold, then again by determining theoretical average gray value It is compared with the second gray value threshold value pre-saved, if more than the second gray value threshold value, is just determined as target decoder Template.In order to keep determining target decoder template more accurate, the first gray value threshold value be should not be too large, second gray scale It is unsuitable too small to be worth threshold value, the first gray value threshold value can be 255/4, and the first gray value threshold value can be 255*3/4.
Embodiment 6:
In order to further increase decoded accuracy, on the basis of the various embodiments described above, in embodiments of the present invention, institute It states according to grayscale information of each module within the scope of corresponding first boundary point of the character to be decoded, decoding to be selected First binary coded data of template and opposed second binary coded data of first binary coded data, The target decoder template for determining the character to be decoded includes:
According to the first binary system of the grayscale information of each module of the character to be decoded and solution code mask to be selected First sum of products of the corresponding element in coded data determines the first average gray value of the character to be decoded;
According to second of the corresponding element in the grayscale information of each module and second binary coded data Sum of products determines the second average gray value of the character to be decoded, wherein the second binary coded data and the described 1st Corresponding element in scale coding data is different;
For the character to be decoded, when by the absolute value of the difference maximum of the first average gray value and the second average gray value Corresponding solution code mask to be selected, is determined as the target decoder template of the character to be decoded.
In embodiments of the present invention, in each module according to the character to be decoded in corresponding first boundary point range First binary coded data of interior grayscale information, solution code mask to be selected and the first binary coded data phase Second binary coded data of opposition, when determining the target decoder template of the character to be decoded, the specific can be that should Pair in first binary coded data of the grayscale information of each module of character to be decoded and solution code mask to be selected It is added after answering the multiplication of element, obtains the first sum of products, by the member in first sum of products and first binary coded data Element is that the ratio of the number of " 1 " is determined as the first average gray value of the character to be decoded, by the every of the character to be decoded Corresponding element in the grayscale information of a module and opposed second binary coded data of first binary coded data It is added after the multiplication of element, obtains the second sum of products, be " 1 " by the element in second sum of products and the first binary coded data The ratio of number be determined as the second average gray value of the character to be decoded, by the first average gray value and the second average ash Corresponding solution code mask to be selected, is determined as the target decoder mould of the character to be decoded when the absolute value of the difference maximum of angle value Plate.Second binary coded data is different from the corresponding element in first binary coded data.
Because if the solution code mask to be selected be target decoder template, then the one or two of the target decoder template into Element " 0 " in coded data processed represents the element respective modules and belongs to aerial module, and the grayscale information of the module is " 255 ", the element " 1 " in the first binary coded data of target decoder template represent the element respective modules and belong in item Module, the grayscale information of the module are " 0 ".
Since the grayscale information of module may not be 0 or 255, but should be close to 0 or 255, for example be 1 or 254, below It is illustrated so that the grayscale information of module is 0 or 255 as an example, has no effect on final result.
If item and empty each module and each module in the character to be decoded to this in target decoder template Correspondence is identical, i.e., element " 1 " is multiplied with grayscale information 0, and element " 0 " is multiplied with grayscale information 255, then in the character to be decoded Each module grayscale information with should corresponding element in first binary coded data of solution code mask be selected the One sum of products is 0, then the first average gray value is 0.When by the grayscale information and target of each module of the character to be decoded When solving the corresponding element multiplication in opposed second binary coded data of the first binary coded data of code mask, element " 1 " is multiplied with grayscale information 255, and element " 0 " is multiplied with grayscale information 0, and corresponding second sum of products is the largest, and second is average Gray value may be 255 to be also maximum.The absolute value of the difference of first average gray value and the second average gray value is maximum.
But due to bar code border position inaccurate, the width and molded breadth of item sky have deviation, are determining that this is to be decoded It is possible that mistake when the grayscale information of each module of character, it will lead to the first average gray value in this way greater than 0, then the Two average gray values less than 255, at this time then by the absolute value of the difference maximum of the first average gray value and the second average gray value when Corresponding solution code mask to be selected, is determined as the target decoder template of the character to be decoded.
Embodiment 7:
On the basis of the various embodiments described above, in embodiments of the present invention, determine that each module of character to be decoded exists Grayscale information within the scope of corresponding first boundary point includes:
For each module of the character to be decoded, determine that the module is located on the horizontal scanning line corresponding first boundary Each pixel in point range;
The gray value for identifying each pixel in the module includes according in the gray value of each pixel and the module Pixel number, determine the grayscale information of the module.
In embodiments of the present invention, in each module for determining character to be decoded within the scope of corresponding first boundary point Grayscale information when, can be determine the module be located at each pixel corresponded within the scope of first boundary point on the horizontal scanning line Point;The gray value for identifying each pixel in the module, according to the picture for including in the gray value of each pixel and the module The number of vegetarian refreshments determines the grayscale information of the module, the specific can be that, by the gray value of all pixels point and and pixel The ratio of number be determined as the gray value of the module, the as grayscale information of the module.
Embodiment 8:
On the basis of the various embodiments described above, in embodiments of the present invention, the type packet of the bar code to be decoded is determined It includes:
Identify the bebinning character of the bar code to be decoded and/or the item sky width of final character;
It is empty wide according to the standard bar of the corresponding bebinning character of each type of bar code and/or final character pre-saved Degree, and the item sky width of identification, determine the type of the bar code to be decoded.
In embodiments of the present invention, the corresponding bebinning character of each type of bar code and/or end are preserved in electronic equipment The only standard bar sky width of character identifies bebinning character and/or the termination of the bar code to be decoded when electronic equipment recognizes It, can be by the starting corresponding with each type of bar code pre-saved of the item sky width of identification when the item sky width of character The standard bar sky width of character and/or final character is matched, and type corresponding when matching high is determined as described to be decoded Bar code type.
Fig. 2 is a kind of bar code decoding process schematic provided in an embodiment of the present invention, and the process includes:
S201: for character to be decoded in bar code, according to the boundary point of the corresponding decoding character of the type of the bar code Quantity and the previous character of the character to be decoded be located at the first object end boundary point on horizontal scanning line, determine The character to be decoded is located at the candidate end boundary point on the horizontal scanning line.
S202: judge corresponding first width value of the character to be decoded with save the second width value difference it is absolute Whether value is less than given threshold, if it is, S203 is executed, if it is not, then executing S204.
S203: the second target candidate's end boundary point character to be decoded as this being located on the horizontal scanning line End boundary point.
S204: identification is located at the distance between each boundary point and the first object end boundary point on horizontal scanning line, Corresponding boundary point, is determined as the character to be decoded when by the distance with the absolute value of the difference minimum of second width value The second target end boundary point on the horizontal scanning line.
S205: according to the corresponding quantity for decoding the module that character includes of the type of the bar code and the first object End boundary point third width value corresponding with the second target end boundary point range, determines each mould of the character to be decoded Block is located at each first boundary point on the horizontal scanning line.
S206: according to the grayscale information of each module of the character to be decoded, with solve code mask first to be selected First sum of products of binary coded data determines the first average gray value of the character to be decoded;According to each mould Second sum of products of the grayscale information of block and second binary coded data determines that the second of the character to be decoded is average Gray value;Corresponding decoding mould to be selected when by the first average gray value with the absolute value of the difference maximum of the second average gray value Plate is determined as the target decoder template of the character to be decoded, according to the target decoder template of the determining character to be decoded, To the Character decoder to be decoded.
Fig. 3 is a kind of bar code provided in an embodiment of the present invention, and the type of the bar code is EAN-13, is wrapped in the bar code of the type The character 2,3,4,5,6,7,8,9,0,1,2,8 containing decoding.Number 1 is used to identify the boundary information of bar code.In the bar code of the type Each decoding character include two two empty, each or it is empty comprising each decoding character of 1-4 standard module include 7 moulds Block, so the number of the element in the first binary coded data of the solution code mask of the decoding character of the type has 7.Below For decoding character " 2 ", the process for the target decoder template for determining the decoding character " 2 " is illustrated.
It is illustrated below with the grayscale information of each module for 255 or 0.
The decoding character " 2 " is first character to be decoded in the bar code, can be by determining character to be decoded Previous character, that is, bebinning character the first object end boundary point character " 2 " to be decoded as this target start boundary Point.Determine that the candidate of the character to be decoded " 2 " terminates according to the boundary point quantity of the corresponding decoding character of the bar code of the type Boundary point.And according to the first object end boundary point the first width value corresponding with the candidate end boundary point range with And the second width value of the decoding character saved, determine the second target knot that the character to be decoded is located on the horizontal scanning line Beam boundary point.After determining the second target end boundary point of character to be decoded " 2 ", so that it may determine the word to be decoded Accord with the corresponding first boundary point of each module of 7 modules in " 2 ".Determine the grayscale information within the scope of the first boundary point, it will First binary coded data of the grayscale information of each module in the character to be decoded " 2 " and solution code mask to be selected In corresponding element multiplication and addition, the first sum of products is obtained, by first sum of products and first binary coded data In element be that the ratio of number of " 1 " is determined as the first average gray value of the character to be decoded, by the decoded character Each module grayscale information and solution code mask to be selected opposed second binary system of the first binary coded data The multiplication and addition of corresponding element in coded data, obtain the second sum of products, by second sum of products and second binary system Element in coded data is that the ratio of the number of " 1 " is determined as the second average gray value of the character to be decoded, by first Corresponding solution code mask to be selected, is determined as this wait solve when equal gray value is with the absolute value of the difference maximum of the second average gray value The target decoder template of the character of code.
For example, the grayscale information of 7 modules of the decoding character are as follows:
255,255,0,255,255,0,0,
If the first binary coded data of the solution code mask to be selected is 0010011, first obtained is average Gray value are as follows:
(255*0+255*0+0*1+255*0+255*0+0*1+0*1)/3=0,
Opposed second binary coded data of the first binary coded data of the solution code mask to be selected is 1101100, the second obtained average gray value are as follows:
(255*1+255*1+0*0+255*1+255*1+0*0+0*0)/4=255, first average gray value and second The absolute value of the difference of average gray value is 255.
If the first binary coded data of the solution code mask to be selected is 0011001, first obtained is average Gray value are as follows:
(255*0+255*0+0*1+255*1+255*0+0*0+0*1)/3=255/3,
Opposed second binary coded data of the first binary coded data of the solution code mask to be selected is 1100110, the second obtained average gray value are as follows:
(255*1+255*1+0*0+255*0+255*1+0*1+0*0)/4=255*3/4, first average gray value with The absolute value of the difference of second average gray value is 255*5/12.
So the target decoder template is 0010011.
Fig. 4 is a kind of bar code decoding structure drawing of device provided in an embodiment of the present invention, and described device includes:
Determining module 41, for being directed to character to be decoded in bar code, according to the corresponding decoded word of the type of the bar code The first object that the previous character of the quantity of the boundary point of symbol and the character to be decoded is located on horizontal scanning line terminates side Boundary's point determines that the character to be decoded is located at the candidate end boundary point on the horizontal scanning line;
The determining module 41 is also used to according to the first object end boundary point and the candidate end boundary point model The second width value for enclosing the decoding character of corresponding first width value and preservation, determines that the character to be decoded is located at the row The second target end boundary point in scan line;
Decoder module 42, for according to first object end boundary point described on the horizontal scanning line and second target Grayscale information in end boundary point range, to the Character decoder to be decoded.
Described device further include:
Update module 43, for according to the first object end boundary point of the previous character of the character to be decoded and should be to The corresponding third width value of the second target end boundary point range of decoded character to the decoding character of preservation second Width value is updated.
The determining module 41, specifically for judging the second of corresponding first width value of the character to be decoded and preservation Whether the absolute value of the difference of width value is less than given threshold;If so, candidate's end boundary point is to be decoded as this Character is located at the second target end boundary point on the horizontal scanning line;If not, identification is located at each side on horizontal scanning line The distance between boundary's point and the first object end boundary point, most by the absolute value of the difference of the distance and second width value Hour corresponding boundary point, is determined as the second target end boundary point that the character to be decoded is located on the horizontal scanning line.
The decoder module 42, specifically for the number for the module that the corresponding decoding character of the type according to the bar code includes Amount and first object end boundary point third width value corresponding with the second target end boundary point range, determine this to Each module of decoded character is located at each first boundary point on the horizontal scanning line;According to the every of the character to be decoded First binary coded number of grayscale information and to be selected solution code mask of a module within the scope of corresponding first boundary point According to determining the target decoder template of the character to be decoded;It is right according to the target decoder template of the determining character to be decoded The Character decoder to be decoded.
The decoder module 42, specifically for each module according to the character to be decoded in corresponding first boundary point First binary coded data of grayscale information, solution code mask to be selected in range and first binary coded number According to opposed second binary coded data, the target decoder template of the character to be decoded is determined, wherein described the second two Scale coding data are different from the corresponding element in first binary coded data.
The decoder module 42, it is and to be selected specifically for the grayscale information according to each module of the character to be decoded First sum of products of the first binary coded data of the solution code mask selected, determines the first average gray of the character to be decoded Value;According to the second sum of products of the grayscale information of each module and second binary coded data, determining should be wait solve Second average gray value of the character of code;By when the absolute value of the difference maximum of the first average gray value and the second average gray value pairs The solution code mask to be selected answered, is determined as the target decoder template of the character to be decoded.
The decoder module 42 determines that the module is located at institute specifically for being directed to each module of the character to be decoded State each pixel corresponded within the scope of first boundary point on horizontal scanning line;Identify the gray scale of each pixel in the module Value, according to the number for the pixel for including in the gray value of each pixel and the module, determines the grayscale information of the module.
The embodiment of the invention discloses a kind of bar code decoding method and devices, which comprises in bar code wait solve The character of code, according to the quantity of the boundary point of the corresponding decoding character of the type of the bar code and the character to be decoded Previous character be located at the first object end boundary point on horizontal scanning line, determine that the character to be decoded is located at the row and sweeps Retouch the candidate end boundary point on line;It is corresponding with the candidate end boundary point range according to the first object end boundary point The first width value and preservation decoding character the second width value, determine that the character to be decoded is located at the horizontal scanning line On the second target end boundary point;According to first object end boundary point described on the horizontal scanning line and second target Grayscale information in end boundary point range, to the Character decoder to be decoded.Due in embodiments of the present invention, according to described The quantity and first object end boundary point of the boundary point of the corresponding decoding character of the type of bar code, determine candidate's end boundary Point, according to the first object end boundary point the first width value corresponding with candidate's end boundary point range and preservation Decoding character the second width value, determine the second target end boundary that the character to be decoded is located on the horizontal scanning line Point.So as to be avoided to a certain extent because the item sky width of decoding character that determines is inaccurate caused by bar code border is unintelligible Really, decoded accuracy is improved to a certain extent.
For systems/devices embodiment, since it is substantially similar to the method embodiment, so the comparison of description is simple Single, the relevent part can refer to the partial explaination of embodiments of method.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or an operation are distinguished with another entity or another operation, without necessarily requiring or implying these entities Or there are any actual relationship or orders between operation.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, the reality of complete hardware embodiment, complete Application Example or connected applications and hardware aspect can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although the preferred embodiment of the application has been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications can be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the application range.
Obviously, those skilled in the art can carry out various modification and variations without departing from the essence of the application to the application Mind and range.In this way, if these modifications and variations of the application belong to the range of the claim of this application and its equivalent technologies Within, then the application is also intended to include these modifications and variations.

Claims (12)

1. a kind of bar code decoding method, which is characterized in that the described method includes:
For character to be decoded in bar code, according to the quantity of the boundary point of the corresponding decoding character of the type of the bar code, with And the previous character of the character to be decoded is located at the first object end boundary point on horizontal scanning line, determines described to be decoded Character be located at the candidate end boundary point on the horizontal scanning line;
According to the first object end boundary point the first width value corresponding with candidate's end boundary point range and guarantor Second width value of the decoding character deposited, the second target for determining that the character to be decoded is located on the horizontal scanning line terminate side Boundary's point;
According in first object end boundary point described on the horizontal scanning line and the second target end boundary point range Grayscale information, to the Character decoder to be decoded;
Wherein, described according to the first object end boundary point the first width corresponding with candidate's end boundary point range Second width value of value and the decoding character saved, determines the second mesh that the character to be decoded is located on the horizontal scanning line Marking end boundary point includes:
Judge whether corresponding first width value of the character to be decoded and the absolute value of the difference of the second width value saved are small In given threshold;
If so, candidate's end boundary point character to be decoded as this to be located to the second target knot on the horizontal scanning line Beam boundary point;
If not, identification is located at the distance between each boundary point and the first object end boundary point on horizontal scanning line, it will Corresponding boundary point, is determined as the character bit to be decoded when the distance is with the absolute value of the difference minimum of second width value In the second target end boundary point on the horizontal scanning line.
2. the method as described in claim 1, which is characterized in that the method also includes:
According to the second mesh of the first object end boundary point of the previous character of the character to be decoded and the character to be decoded The corresponding third width value of mark end boundary point range is updated the second width value of the decoding character of preservation.
3. the method as described in claim 1, which is characterized in that described to be terminated according to first object described on the horizontal scanning line Boundary point and the grayscale information in the second target end boundary point range include: to the Character decoder to be decoded
According to the quantity and the first object end boundary of the module that the corresponding decoding character of the type of the bar code includes Point third width value corresponding with the second target end boundary point range, determines that each module of the character to be decoded is located at institute State each first boundary point on horizontal scanning line;
According to grayscale information of each module of the character to be decoded within the scope of corresponding first boundary point and to be selected The first binary coded data for solving code mask, determines the target decoder template of the character to be decoded;
According to the target decoder template of the determining character to be decoded, to the Character decoder to be decoded.
4. method as claimed in claim 3, which is characterized in that each module according to the character to be decoded is in correspondence First boundary point within the scope of grayscale information and solution code mask to be selected the first binary coded data, determining should be wait solve The target decoder template of character of code includes:
According to grayscale information of each module within the scope of corresponding first boundary point of the character to be decoded, solution to be selected First binary coded data of code mask and opposed second binary coded number of first binary coded data According to, determine the target decoder template of the character to be decoded, wherein second binary coded data with the described 1st into Corresponding element in coded data processed is different.
5. method as claimed in claim 4, which is characterized in that each module according to the character to be decoded is in correspondence First boundary point within the scope of grayscale information, solution code mask to be selected the first binary coded data and described first Opposed second binary coded data of binary coded data determines the target decoder template packet of the character to be decoded It includes:
The first binary coding according to the grayscale information of each module of the character to be decoded, with solution code mask to be selected First sum of products of data determines the first average gray value of the character to be decoded;
According to the second sum of products of the grayscale information of each module and second binary coded data, determining should be wait solve Second average gray value of the character of code;
Corresponding solution code mask to be selected when by the first average gray value with the absolute value of the difference maximum of the second average gray value, It is determined as the target decoder template of the character to be decoded.
6. such as the described in any item methods of claim 3-5, which is characterized in that determine each module of character to be decoded right The grayscale information within the scope of first boundary point answered includes:
For each module of the character to be decoded, determines the module to be located on the horizontal scanning line and correspond to first boundary point model Enclose interior each pixel;
The gray value for identifying each pixel in the module, according to the picture for including in the gray value of each pixel and the module The number of vegetarian refreshments determines the grayscale information of the module.
7. a kind of bar code decoding device, which is characterized in that described device includes:
Determining module, for being directed to character to be decoded in bar code, according to the side of the corresponding decoding character of the type of the bar code The previous character of the quantity of boundary's point and the character to be decoded is located at the first object end boundary point on horizontal scanning line, Determine that the character to be decoded is located at the candidate end boundary point on the horizontal scanning line;
The determining module is also used to corresponding with the candidate end boundary point range according to the first object end boundary point The first width value and preservation decoding character the second width value, determine that the character to be decoded is located at the horizontal scanning line On the second target end boundary point;
Decoder module, for terminating side according to first object end boundary point described on the horizontal scanning line and second target Grayscale information in boundary's point range, to the Character decoder to be decoded;
Wherein, the determining module, specifically for judging the second of corresponding first width value of the character to be decoded and preservation Whether the absolute value of the difference of width value is less than given threshold;If so, candidate's end boundary point is to be decoded as this Character is located at the second target end boundary point on the horizontal scanning line;If not, identification is located at each side on horizontal scanning line The distance between boundary's point and the first object end boundary point, most by the absolute value of the difference of the distance and second width value Hour corresponding boundary point, is determined as the second target end boundary point that the character to be decoded is located on the horizontal scanning line.
8. device as claimed in claim 7, which is characterized in that described device further include:
Update module, the first object end boundary point for the previous character according to the character to be decoded are to be decoded with this Second width value of the corresponding third width value of the second target end boundary point range of character to the decoding character of preservation It is updated.
9. device as claimed in claim 7, which is characterized in that the decoder module, specifically for the class according to the bar code The quantity for the module that the corresponding decoding character of type includes and the first object end boundary point and the second target end boundary The corresponding third width value of point range determines that each module of the character to be decoded each of is located on the horizontal scanning line One boundary point;According to grayscale information of each module of the character to be decoded within the scope of corresponding first boundary point and to be selected First binary coded data of the solution code mask selected, determines the target decoder template of the character to be decoded;According to determining The target decoder template of the character to be decoded, to the Character decoder to be decoded.
10. device as claimed in claim 9, which is characterized in that the decoder module, specifically for according to the word to be decoded Grayscale information of each module of symbol within the scope of corresponding first boundary point, the first binary system for solving code mask to be selected are compiled Yardage accordingly and opposed second binary coded data of first binary coded data, determines the character to be decoded Target decoder template, wherein the corresponding element in second binary coded data and first binary coded data It is different.
11. device as claimed in claim 10, which is characterized in that the decoder module, specifically for be decoded according to this The grayscale information of each module of character, the first sum of products with the first binary coded data of solution code mask to be selected, Determine the first average gray value of the character to be decoded;According to the grayscale information of each module and second binary system Second sum of products of coded data determines the second average gray value of the character to be decoded;By the first average gray value and Corresponding solution code mask to be selected, is determined as the mesh of the character to be decoded when the absolute value of the difference maximum of two average gray values Mark solution code mask.
12. such as the described in any item devices of claim 9-11, which is characterized in that the decoder module is specifically used for being directed to and be somebody's turn to do Each module of character to be decoded determines that the module is located on the horizontal scanning line and each of corresponds within the scope of first boundary point Pixel;The gray value for identifying each pixel in the module includes according in the gray value of each pixel and the module Pixel number, determine the grayscale information of the module.
CN201710170763.4A 2017-03-21 2017-03-21 A kind of bar code decoding method and device Active CN106991348B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710170763.4A CN106991348B (en) 2017-03-21 2017-03-21 A kind of bar code decoding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710170763.4A CN106991348B (en) 2017-03-21 2017-03-21 A kind of bar code decoding method and device

Publications (2)

Publication Number Publication Date
CN106991348A CN106991348A (en) 2017-07-28
CN106991348B true CN106991348B (en) 2019-11-15

Family

ID=59413302

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710170763.4A Active CN106991348B (en) 2017-03-21 2017-03-21 A kind of bar code decoding method and device

Country Status (1)

Country Link
CN (1) CN106991348B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110874538B (en) * 2018-08-29 2023-06-02 杭州海康威视数字技术股份有限公司 Method and device for evaluating decoding result of bar code and electronic equipment
CN109697382B (en) * 2018-12-18 2022-05-10 福州图腾易讯信息技术有限公司 Linear bar code edge distortion processing method and equipment
CN116842977B (en) * 2023-08-31 2023-11-17 中科微至科技股份有限公司 Bar code identification method

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5818026A (en) * 1996-02-06 1998-10-06 Symbol Technologies, Inc. Hand-marked lottery selection slip scanning system and method
CN1452117A (en) * 2003-05-22 2003-10-29 深圳矽感科技有限公司 Two-D bar code encoding and decoding method
CN101833641A (en) * 2010-06-01 2010-09-15 福建新大陆电脑股份有限公司 Bar code decoding chip
CN101833640A (en) * 2010-06-01 2010-09-15 福建新大陆电脑股份有限公司 Module for calculating bar space boundary pixel points and calculating method thereof
CN101840496A (en) * 2010-06-01 2010-09-22 福建新大陆电脑股份有限公司 One-dimensional barcode decoding chip
CN101882202A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Sign character extracting module and method
CN101882205A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Bar code image scanning method
CN103034833A (en) * 2011-09-29 2013-04-10 无锡爱丁阁信息科技有限公司 Bar code positioning method and bar code detection device
CN105512594A (en) * 2014-10-09 2016-04-20 康耐视公司 Decoding barcodes

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI391862B (en) * 2008-06-06 2013-04-01 Elan Microelectronics Corp A two-dimensional dot code, a decoding apparatus, and a method thereof
JP6095194B2 (en) * 2013-03-28 2017-03-15 日本電産サンキョー株式会社 Stack bar code reading apparatus and stack bar code reading method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5818026A (en) * 1996-02-06 1998-10-06 Symbol Technologies, Inc. Hand-marked lottery selection slip scanning system and method
CN1452117A (en) * 2003-05-22 2003-10-29 深圳矽感科技有限公司 Two-D bar code encoding and decoding method
CN101833641A (en) * 2010-06-01 2010-09-15 福建新大陆电脑股份有限公司 Bar code decoding chip
CN101833640A (en) * 2010-06-01 2010-09-15 福建新大陆电脑股份有限公司 Module for calculating bar space boundary pixel points and calculating method thereof
CN101840496A (en) * 2010-06-01 2010-09-22 福建新大陆电脑股份有限公司 One-dimensional barcode decoding chip
CN101882202A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Sign character extracting module and method
CN101882205A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Bar code image scanning method
CN103034833A (en) * 2011-09-29 2013-04-10 无锡爱丁阁信息科技有限公司 Bar code positioning method and bar code detection device
CN105512594A (en) * 2014-10-09 2016-04-20 康耐视公司 Decoding barcodes

Also Published As

Publication number Publication date
CN106991348A (en) 2017-07-28

Similar Documents

Publication Publication Date Title
CN106991348B (en) A kind of bar code decoding method and device
CN101908125B (en) QR (Quick Response) bar code decoding chip and decoding method thereof
CN107016318B (en) A kind of bar code decoding method and device
CN111444775B (en) Face key point correction method and device and computer equipment
CN109840278A (en) Histogram data switching control method, device, computer equipment and storage medium
CN110751500B (en) Processing method and device for sharing pictures, computer equipment and storage medium
CN112036292A (en) Character recognition method and device based on neural network and readable storage medium
CN110287831A (en) A kind of acquisition methods, device and the electronic equipment at the control point based on terrestrial reference
CN112200218B (en) Model training method and device and electronic equipment
CN104217189A (en) Self-learning identification method of barcode used for test strip
CN105718965A (en) Chinese character writing font identification method and Chinese character writing font identification device
CN103679502A (en) Application recommendation method and system thereof
CN116612265A (en) Target encoding and decoding-based dial pointer reading identification method
CN110895849A (en) Method and device for cutting and positioning crown word number, computer equipment and storage medium
CN101833645A (en) Bar code decoding method based on code word combination
CN106991347B (en) The localization method and device of identifier word symbol in a kind of bar code
CN107016388B (en) A kind of localization method and device in one-dimension code region
CN114358023A (en) Intelligent question-answer recall method and device, computer equipment and storage medium
CN112819622A (en) Information entity relationship joint extraction method and device and terminal equipment
CN110134927A (en) The measurement report generation method and storage medium of electronic drawing
CN116128954B (en) Commodity layout identification method, device and storage medium based on generation network
CN109697382A (en) A kind of linear code edge distortion processing method and equipment
CN111369441B (en) Word processing method, medium, device and apparatus
CN113255683B (en) Image segmentation method, system and storage medium based on neural network
CN112381147B (en) Dynamic picture similarity model establishment and similarity calculation method and device

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
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: C10, No. 1199 Bin'an Road, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Zhejiang Huarui Technology Co.,Ltd.

Address before: C10, No. 1199 Bin'an Road, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: ZHEJIANG HUARAY TECHNOLOGY Co.,Ltd.