Optical code reading

The optical code reading method employs a schema-based approach with fixed and variable character positions to enhance error detection and correction, addressing the limitations of conventional methods by reducing misreadings and missing readings in barcode scanning.

JP7547534B2Active Publication Date: 2024-09-09SICK AG
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2023043250
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-04-05
Filing Date
2023-03-17
Publication Date
2024-09-09
Estimated Expiration
2043-03-17

AI Technical Summary

Technical Problem

Conventional optical code reading methods for barcodes are vulnerable to multiple error situations, leading to increased misreading and missing readings, especially in conditions with localized defects or reflections, as checksum corrections are limited to single errors and Reed-Solomon correction is not applicable.

Method used

An optical code reading method that utilizes a schema with fixed and variable character positions, allowing for character comparison and correction based on prior knowledge, including a checksum verification, to enhance error detection and correction capabilities.

Benefits of technology

The method significantly reduces the risk of unnoticed misreadings and missing readings by enabling correction of multiple errors, improving reading reliability and accuracy, particularly for barcodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007547534000006
    Figure 0007547534000006
  • Figure 0007547534000005
    Figure 0007547534000005
  • Figure 0007547534000003
    Figure 0007547534000003
Patent Text Reader

Abstract

To provide a more reliable and robust method of reading optical codes, compared with the case of reading optical codes obtained by encoding a message including a character string having many characters.SOLUTION: A method for inspecting and / or correcting a message read from an optical code, based on a scheme, includes: acquiring image data including an optical code; reading a message; evaluating an image; comparing characters of the read message with a scheme that contains a fixed character for at least one position in the message that is expected at this position in optical codes to be read; and recognizing an incorrectly read message and / or correcting the read message based on the comparison with the scheme. The scheme contains a variable character that is expected at this position in codes to be read for at least one position of the message, with a variable character being set to a partial range of the possible characters, but not to a fixed character.SELECTED DRAWING: Figure 6
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a method for reading an optical code and to an optoelectronic code reader as defined in the preambles of claims 1 and 14 respectively. [Background technology]

[0002] Code readers are known for their use in logistics, such as at supermarket checkouts, automatic baggage identification, mail sorting, and baggage dispatch at airports. In a code scanner, the reading beam is guided across the code by a rotating mirror or polygon mirror wheel. Camera-based code readers use an image sensor to take an image of an object with a code on its surface, and image analysis software extracts the code information from the image.

[0003] In one important group of applications, objects bearing codes are conveyed past a code reader. A scanning code reader detects each successive code that enters its reading field. In camera-based code readers, on the other hand, a line-scan camera reads the object image carrying the code information line by line as it moves relative to the object. When using a two-dimensional image sensor, multiple image data are regularly acquired, with some overlap depending on the imaging rate and the conveying speed. To allow objects to be positioned on the conveyor in any orientation, multiple code readers are often provided in the reading tunnel, so that the object can be imaged from several or all sides. Scanning code readers can also capture diffuse reflected light and ultimately capture multiple image lines that can be combined into an object image, but in practice image sensors are preferred for this purpose. Code areas can be identified in such object images to read one- or two-dimensional codes.

[0004] A high read rate is one of the most important quality criteria for code readers and reading tunnels. Reading errors require costly rectification procedures, such as manual rescanning or subsequent sorting. The causes of such errors can be the quality of the code itself, unfavourable reading conditions (e.g. the code being underneath a film that creates reflections) and finally evaluation errors in the form of binarisation of greyscale values ​​or inaccurate calculated scanning positions.

[0005] To avoid reading errors, conventional decoders for 2D codes such as DataMatrix, QR, Aztec, Maxicode, Dot-Code, etc., and stacked codes (Stapelcode) such as PDF417, MicroPDF, etc., are equipped with Reed-Solomon correction. This allows a powerful correction process that allows even codes with large surface defects to be read correctly. Not only can codes that would otherwise be unreadable (NoRead) still be read, but so-called misreads (MisRead) are also avoided. In the case of a misread, the code is read incorrectly and goes unnoticed. With Reed-Solomon correction, this practically does not happen. If the error correction capability is exceeded, the code in question simply cannot be decoded any further (NoRead).

[0006] However, Reed-Solomon correction is not available for barcodes. The concept "barcode" here should be understood as a 1D barcode, although in the literature 2D codes are sometimes called barcodes as well, contrary to this. The reading of a barcode is usually verified using a checksum. If the checksum calculated from the read payload matches the checksum read together, the decoding is assumed to be correct. Any difference means that at least one character in the payload or checksum was read incorrectly, which usually results in a read error (NoRead).

[0007] The checksum can be used to correct a single undecodable or defective payload character by reversing the checksum technique and subsequently setting the payload character to a value such that the checksum calculated from the payload matches the checksum read. This form of correction is limited to a single character and cannot be applied to larger areas of corrupted code, in which case a NoRead remains.

[0008] Moreover, the checksum may be read incorrectly without being noticed, resulting in undecodable or defective payload characters being set to the wrong value in a correction attempt. Or even worse, all payload characters may be perfectly correct, but errors may be introduced only by a correction attempt using an incorrect checksum. The same can happen with a correct checksum, where two or more payload characters are unnoticed and decoded incorrectly, and the cumulative result of these errors happens to be the correct checksum. Thus, a simple checksum-based correction method for barcodes increases the read rate but also increases the risk of misreads.

[0009] Thus, a checksum can only reliably catch a single error, and therefore traditional corrections for barcodes are vulnerable to situations where there are multiple errors. However, in practice it is not at all unusual for a code to be corrupted in multiple places, for example, in a soft packaging such as a paper bag with a highly wavy substrate, in a barcode label that is partly attached to the seam of a cardboard package, or in a barcode underneath a highly reflective film with many localized planar defects.

[0010] In the patent application EP 1 269 636 A1, a method for reading optical codes is presented, in which a preliminary correction, which is carried out before the inspection process, replaces a code word at least in one place of the code with a known code word corresponding to said place. The known code word is parameterized, predefined in a database of a higher-level system, or learned from the reading history of the code. This preliminary correction is designed to complement the later Reed-Solomon correction. This preliminary correction does not bring about any improvement in the variable part of the code, whose code word is not known. The error correction in the variable part is the responsibility of the later Reed-Solomon correction. The advantage of the patent application EP 1 269 636 A1 is that after the preliminary correction, all the error correction capacity is available for the Reed-Solomon correction, and no part of it is consumed in advance for the correction of known code words. Therefore, in the case of bar codes that cannot be Reed-Solomon corrected, all the disadvantages mentioned for the very limited correction by checksum remain, at least for the variable part of the code. [Prior art documents] [Patent documents]

[0011] [Patent Document 1] EP 3 428 835 B1 Summary of the Invention [Problem to be solved by the invention]

[0012] It is therefore an object of the present invention to provide a more reliable and robust method for reading optical codes. [Means for solving the problem]

[0013] This problem is solved by a method for reading an optical code and an optoelectronic code reader as described in claims 1 and 14, respectively. For the sake of clarity, what is concerned here is an automatically executed method, in particular a computer-implemented method. A human being would in any case be overly demanding to see due to the amount of information involved. The optical code contains a message. It is the plain text to be transmitted by the optical code and is encoded in the code. This message comprises a string of characters with a number of characters. In addition to the payload characters, the message preferably also contains at least one check character, for example a checksum. To read the code and thus the message, first image data containing the optical code is acquired in any of the known ways described at the beginning. Then, in the image data, a code region is found, preferably by preprocessing. In the preprocessing, the image data is segmented, for example based on contrast. Then, each code in the code region is decoded, and the message is read.

[0014] The characters of the read message are compared with a schema. The schema contains prior knowledge about the code to be read. It has a fixed part. That is, due to the schema, certain fixed characters are expected at least at one place in the message. That is, it is known which characters should be there or what the message should be at that place. If there are several code families that appear in a certain context of use, each with its own fixed part, there may be several schemas, in which case it is preferable to first identify and use the appropriate schema (for example the one that best matches the current code). The schema makes it possible to recognize the incorrectly read message when the fixed part of the schema is not read as expected in the message and / or to correct the read message by partial correction or replacement of the message based on prior knowledge of the fixed part of the schema. Up to this point, the method of the present invention is similar to the initially mentioned patent application WO 2005 / 023364, to which reference is made for supplementary information.

[0015] The basic idea from which the invention starts is to provide an additional variable part in the schema. At least one place in the message is awaited a variable character that is not fixed to a fixed character, but varies only within a partial range of all possible characters. Typical examples of variable characters are numbers or phonetic characters. The comparison of the read characters in the message with the schema also includes the variable part. If a character is read in the message at the place of the variable character that does not match the schema, it is recognized as an error. For example, a number is read where a phonetic character should be according to the schema. This error can be output as it is (MisRead) or an attempt can be made to correct it, for example based on a checksum. By their respective definitions, fixed characters and variable characters are mutually exclusive, and therefore their respective positions are different according to the schema.

[0016] The invention has the advantage that the reading rate is further increased, and this applies both to no-reads (NoRead) and to misreads (MisRead). No-reads require laborious post-processing, e.g. manual acquisition of the code again, and misreads can even lead to very expensive errors that go unnoticed during code-controlled allocations, such as sorting, dispatching, etc. The correction according to the invention is not limited to single errors. Missing characters can also be filled in, and the code length can then be correctly reconstructed again. In particular, the risk that a misread will remain unnoticed after a correction failure is significantly reduced. As will be explained in more detail later, the schema can be parameterized in an understandable way, e.g. in a user interface, using an efficient grammar, or even automatically learned from the decoding process or from a suitable log file. The invention is particularly suitable for barcodes, since in the latter case no Reed-Solomon correction is available, and therefore the preliminary correction of US Pat. No. 5,399,323 is insufficient. However, it is still possible to use the invention for two-dimensional codes instead of or as a complement to Reed-Solomon correction. Although Reed-Solomon correction is robust and powerful in itself, its error correction capability is not infinite.

[0017] The scheme preferably comprises the code length and / or contains one fixed or one variable character per position. The code length information, i.e. the total number of characters in the message, therefore belongs to this scheme. The scheme is preferably complete, i.e. it is known from the scheme for each position of the message which fixed character is there or which subrange of possible characters can be there as variable characters. This completeness implies the code length, but it can also be an explicit parameter of the scheme in addition. The scheme can also be incomplete, in which case there is at least one character that is completely free within the limits of the basic code specification. This can be a temporary state that appears especially during the learning of the scheme.

[0018] It is preferable to select the one to be applied from among several schemes, which has a set of fixed characters that are most often found in the read message. There may be a pool of schemes corresponding to different code families expected in a given usage situation. A selection is then made as to which scheme is to be used to check an incorrectly read message or to correct a read message. For this purpose, the fixed part of the scheme can be understood as a kind of fingerprint. The scheme with the fingerprint that best matches the read message is used. In the ideal case, the entire fixed part of a scheme is read in the message. In case of only a partial match, an evaluation can be made, for example, through the number of fixed characters read in agreement with the scheme and / or the highest percentage of fixed characters thus read.

[0019] Preferably, the code comprises a checksum and the validity of the read of the message is verified based on said checksum. In this case, the message contains at least one check character in addition to the payload characters. The checksum is calculated from the read payload characters using the same algorithm that was used to calculate the checksum when the code was first generated. If the calculated checksum and the read checksum match, the message is considered valid. This catches any MisReads.

[0020] Preferably, at the position of a variable character, a character that is not within the subrange of characters that the variable character can take or an unreadable character is corrected using a checksum, and the result is accepted as a correctly read message only if the corrected character is within the subrange of characters that the variable character can take. Here, a correction based on a checksum is performed in the variable part. It was explained at the beginning that this correction is only possible for single errors, and that in the case of multiple errors additional misreads may occur. The checksum can essentially only verify the completeness of the message or be taken into account for the correction, since a perfect match with the checksum is necessary in the end. Here, an additional security can be ensured by the schema, since the corrected message must still fulfill the schema. This catches at least some of the additional misreads.

[0021] If a minimum percentage, in particular at least half, of the fixed characters of the schema are read correctly in the message, then the remaining fixed characters of the schema are preferably carried over into the message. This also corresponds to a correction using the fixed part. Here, the additional condition is imposed that the fixed part of the schema is found with sufficient reliability in the read message. For this purpose, it is required that a minimum percentage, in particular at least half, of the fixed characters are read in accordance with the schema. The fixed characters of the message may be overwritten by characters from the fixed part, but these characters may also be inserted in the sense that this lengthens the message. An indication that this correction is necessary can be given if the validation using the checksum fails. If the message is validated using the checksum, then for efficiency reasons the check and possibly the correction of the fixed part can be omitted. Conversely, it is preferable to check the validation and / or the code length again based on the checksum after the correction. If there are still errors, they are output as a read error (NoRead). It is still conceivable to try a correction in advance in the variable part using the checksum, but this entails the already explained risk of inducing a misread (MisRead). It is also preferable to call it a read error (NoRead) if the minimum percentage of fixed characters read correctly is not reached. In that case, the assignment to the schema is too uncertain to attempt a correction. The robustness in this regard can be adjusted via the minimum percentage.

[0022] Messages with a length that does not match the length of the scheme or with a character at the position of a variable character that is not within the subrange of characters that the variable character can take are preferably classified as misread. This step is preferably performed after the correction, but can also be performed independently of the correction, especially if the message can be validated based on the checksum from the beginning. Due to the code length and the presetting of the scheme for the variable characters, misreadings in the case of multiple errors can still be at least partially found out. In principle, the read checksum can be calculated even if several characters are incorrect, provided that the variable characters satisfy the scheme, but the possibility of such multiple errors is clearly reduced. It is, so to speak, the case that the checksum is read correctly as such, but the checksum itself is part of a multiple error.

[0023] The schema preferably comprises at least one of each subrange of characters that the variable characters can take: non-printable characters, special characters, digits, phonograms, lowercase letters and uppercase letters. These are particularly suitable examples of divisions or classes of characters that can be considered in a message. In principle the division can be made entirely arbitrary. However, such semantic classes are easier for the user to understand, so that the usage can be diagnosed and optimized more easily. Moreover, the regularities in the code are also in practice in the form of semantic classes rather than arbitrary divisions. The characters that the code can take are often represented by the ASCII codes 0 to 127. The above-mentioned subranges can also be found in the ASCII code.

[0024] The schema is preferably expressed as a regular expression indicating the allowable characters for each position. Regular expressions make it easier for users to understand and possibly edit the schema, and also simplify internal processing and make programming the decoder less error-prone. Alternatively, one could define their own schema, but preferably it would at least approximate the understandability and formal regularity of regular expressions.

[0025] To learn the schema, a large number of read messages are evaluated, preferably in particular by obtaining the read messages during operation or reading them out from a log file. It is certainly conceivable in principle to determine the schema directly, in particular by parameter setting in a graphical user interface or by reading them out using a data carrier or a network. This is entirely useful for diagnosing or improving the schema. In the present embodiment, however, the learning is carried out automatically, thus relieving the user of this task. The learning is carried out on the basis of read messages, which can preferably be obtained from the current or previous operation (in particular from a log file). It is also conceivable to adapt the schema during operation. It is advantageous if it is known that the messages from which the schema is learned are correctly read messages. In addition, it is preferable to use only the first correctly read reads, in particular those that have not been subjected to correction based on a checksum. However, even if there are a few messages with missing characters and / or containing incorrect characters, it is still possible to derive the schema from the read messages, for example by statistical methods. During learning, it is preferable to input only codes from one code family, or to sort the read messages so that multiple schemata can be learned for multiple code families. The sorting criterion can be the code length, but also parts of the schema itself, in particular different fixed parts. Then, it may happen that during the learning process, two or more schemata are created from one schema due to differences in the fixed parts.

[0026] The schema preferably learns from the distribution of characters read at each position of the read message, thereby determining which characters appear at each position of the message, and can additionally count how frequently a character is read at each position.

[0027] Preferably, at positions where the same character is always read, a fixed character is learned, and at positions where various characters are read, the subrange formed by these characters is learned as a variable character. According to this, the characters that are read repeatedly and invariably at a position are added to the fixed part of the schema. Additional criteria can then be provided, such as the fixed part forming a block of adjacent characters or being at the beginning or end of the message. If the characters read at a position vary, the subrange spanned by them is considered as a variable character of the schema. This subrange can possibly be further expanded in order to cover a special subrange as a whole. For example, if the characters 1, 3, 6 are read at a position, the subrange may consist of exactly these characters {1, 3, 6}, or the entire interval {1, 2, 3, 4, 5, 6}, including the characters 2, 4, 5 that were not read between the smallest and largest characters read 1 and 6, or it may consist of the complete class of digits, depending on the embodiment. If an almost arbitrary random character is read at a position, then neither a fixed nor a useful variable part can be learned for the schema. Either leave a free place in the schema, i.e. a virtually unlimited number of variable characters, or stop learning. Furthermore, we can try to find a subset of the read message that removes the outliers that led to this situation. We can output the outliers so that the user can check whether it is appropriate not to consider this read message in the schema.

[0028] Preferably, the schema is first initialized position by position with an empty area, the first character read at each position is stored for that position, and if a character read at a position after the first character is not yet known for that position, the subrange for that position is expanded to include said character. This is an advantageous implementation of learning the schema. As always, it is preferable to sort the read messages on which each schema is learned to belong to the same code family. First, an empty schema is initialized with no prior knowledge of any position. The character read at each position is initially considered to be the fixed character of the schema. However, it must then be proven correct through further read messages. One may then require that the fixed character has been read at least m times or m out of n times. If another character is read at a position, it can be considered an outlier according to the m out of n criterion. However, preferably, the subrange of the variable character is spanned by the characters read at this position up to that point. Each time a new character is read at a variable character position, the subrange can be expanded. Preferably, the subrange should be limited to one class (digits, phonograms, etc.), otherwise the subrange may be too large, or a learning error message may be issued, since there is no regularity or system at this location that can be meaningfully captured in the schema.

[0029] In a preferred development, the photoelectric code reader is provided with at least one light receiving element for generating image data from the received light and an internal and / or external control and evaluation unit in which the optical code reading method according to the invention is implemented.

[0030] The invention, together with further features and advantages thereof, will now be described in greater detail with reference to exemplary embodiments and with reference to the accompanying drawings, in which: FIG. [Brief description of the drawings]

[0031] [Figure 1] 1 is a schematic overall view of a code reader exemplary mounted above a conveyor belt carrying objects bearing optical codes to be read; [Diagram 2] Example image of an optical code that is underneath a film and difficult to read due to reflections. [Diagram 3] 1 illustrates an exemplary flowchart for learning a schema for inspecting and / or correcting a message read from an optical code. [Figure 4] A diagram showing several read messages together with an illustration of the schema learned from them. [Diagram 5] An exemplary division of possible characters (here, ASCII codes) in a subrange of the variable part of the schema. [Figure 6] 1 illustrates an exemplary flow chart for inspecting and / or correcting a message read from an optical code based on a schema. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0032] FIG. 1 shows a photoelectric code reader 10 mounted above a belt conveyor 12. The belt conveyor 12 transports objects 14 through a detection area 18 of the code reader 10 as indicated by an arrow 16. The objects 14 have a code area 20 on their outer surface, which is detected and evaluated by the code reader 10. This code area 20 can only be recognized by the code reader 10 if it is attached to the top surface, or at least if it is attached so that it is visible from above. It is therefore possible to deviate from the illustration of FIG. 1 by mounting several code readers 10 from different directions, for example to read a code 22 attached to the side or bottom surface, thereby enabling so-called multiple reading from all directions. In practice, the arrangement of several code readers 10 in a reading system is almost always implemented as a reading tunnel. In practice, it is very common to use code readers fixed in the vicinity of a belt conveyor in this way. However, since the present invention relates to the reading of codes or to the code reader 10 itself, this example should not be interpreted as limiting. For example, codes can also be scanned manually. Additionally, in presentation type applications, a code or an object 14 bearing a code can be held within the reading field of the code reader 10 .

[0033] The code reader 10 acquires image data of the transported object 14 and the code field 20 by means of a receiver 24, which are further processed by the control and evaluation unit 26 using image analysis and decoding methods. The specific imaging method is not important for the invention, so that the code reader 10 can be constructed according to any principle known per se. For example, if only one line is captured each time, a line-shaped image sensor can be used or a scanning method can be used, and the control and evaluation unit 26 combines the lines acquired during the transport movement into image data. If a matrix-shaped image sensor is used, a larger area can be captured with just one exposure. Here too, the combination of the captured images can take place both in the transport direction and in the transverse direction. The most important function of the code reader 10 is decoding, i.e. reading the message encoded in the optical code as plain text. The message is a string of payload characters, preferably accompanied by at least one test character, which is typically at the end. The code reader 10 outputs information (message read from the code, image data, etc.) via an interface 28.

[0034] The checking and / or correction of the messages respectively read out from the code will now be described with reference to figures 2 to 6. This is preferably carried out in the control and evaluation unit 26. However, it is equally conceivable to output the image data or intermediate results via the interface 28 and to submit at least part of the decoding, checking and / or correction to an external higher-level system, such as a control computer, a network or the cloud. The pre-processing of the image data for segmentation and finding of the code regions 20, as well as the decoding itself, is considered to be known and will not be described here.

[0035] Figure 2 shows an example image of an optical code that is under a film and difficult to read due to reflections. As is often the case in practice, there are several codes on a label. Of particular importance for the reading of the codes are the so-called sorting-relevant codes, which carry information regarding the subsequent sorting of the goods. There may be other codes nearby. However, it is of no use to be able to read, for example, the top code in Figure 2, if the sorting-relevant codes cannot be read. It is also natural to envisage situations in which code reflections or other damage or interference apply to all codes in the code area 20, or conversely, situations in which all codes are sorting-relevant or their correct decoding is essential for use elsewhere.

[0036] In order to increase the reading rate for codes damaged by reflections or other corruptions as in Fig. 2, prior knowledge about the code is taken into account in the scheme. Reading errors (NoRead) can then still be avoided or misreads (MisRead) detected by completing the read message based on the scheme. This is explained with the example of a barcode, also shown in Fig. 2. The invention is particularly useful for barcodes, since powerful corrections such as Reed-Solomon coding are available for other code formats, but this does not exclude the application of the invention to other types of codes.

[0037] 3 shows an exemplary flow chart for the automatic learning of a schema. Alternatively, the schema can be entered, in particular via a graphical user interface, or read from a data carrier. The user interface is suitable for displaying, inspecting and possibly editing the learned schema.

[0038] In step T1 a number of read messages are obtained, which are the result of decoding the optical code as it appears in subsequent use. These read messages can be obtained incrementally during the course of the run and / or from the past (e.g. from a log file containing previous reads).

[0039] In step T2, the read messages are evaluated to determine the code types occurring, for example by statistics of the code lengths occurring. This makes it possible to ascertain for which code families a schema should be generated. For example, if only sorting-relevant codes need to be checked or corrected later on based on a schema, the corresponding code families are recognized by their code lengths, specific identifiers or content. A schema is built up in each case only on the basis of a subset of the read messages that belong to the relevant code family. It is conceivable to learn only a single schema for the most frequent codes or for a given code family. In that case, step T1 preferably provides only sorted read messages for that code family.

[0040] In step T3, based on the message read, it is evaluated which characters appear in which positions for a given code family or scheme, for example by simply associating each position with a large unsorted number of characters read, by creating a region for each position that contains all the characters read at that position, or by forming a true frequency distribution for each position of the characters read.

[0041] Then, in step T4, a schema is derived from the character-by-character distribution. The schema usually has a fixed part and a variable part. The fixed characters of the fixed part of the schema are repeated in every character read during training for each code family, or are repeated m times, which is at least a majority of n cases, to allow for outliers. The fixed part is also a means of identifying the code family of the schema. Therefore, it is possible to generate at least one additional schema, because if two different fixed parts are found in the same position in the read message, it is probably not actually the same code family but two code families. The fixed part is later useful during the run to find the correct schema for the latest code read.

[0042] The variable characters in the variable part of the schema are not the same across the messages read like fixed characters, but remain within a subrange of possible characters, for example phonograms or digits. If the interval width of the distribution determined at a certain position in step T3 becomes too large, the variable character will eventually lose its meaning since it no longer has much predictive power. It then becomes a free character. This may be accepted in the schema, but may also result in an error message saying that there is no suitable schema for the input data of these read messages (especially if there are several free characters).

[0043] Steps T1 to T4 do not have to be performed exactly once as described above. In particular, a stepwise or iterative approach is possible, in which further read messages are evaluated one after the other. In that case, a different schema is opened accordingly, if possible, in step T2 and supplemented in steps T3 and T4 to make it suitable for the read message. Such an iterative adaptation of the schema could also be performed on the fly during the actual reading run. To statistically demonstrate the persuasiveness of the schema, it can be required that at least a minimum number of read messages are included in the schema.

[0044] Figure 4 shows a number of read messages together with an illustration of the schemata learned from them. This is a particularly advantageous implementation of the learning shown in Figure 3 and will be used to further illustrate the process of acquiring prior knowledge in the form of schemata.

[0045] For this purpose, Fig. 5 additionally shows an exemplary division of possible characters in each subrange for the variable characters of the scheme. The table includes ASCII values ​​from 0 to 127 that are particularly relevant for barcodes and are divided into seven classes: non-printable characters, special characters #1, numbers, special characters #2, uppercase letters, special characters #3 and lowercase letters. The corresponding ASCII value ranges can be easily seen from the legend and the highlighting bars in the table. Naturally, the invention is not limited to these classes in particular. However, the semantic division makes sense, because it is more understandable for the user and because real code families typically follow a scheme in which the variable characters are not arbitrary but are limited to semantic subranges.

[0046] Returning to Fig. 4, in the top left corner, 10 read messages with code length 21 are shown as input data according to step T1 of Fig. 3. Preferably, the read messages are uncorrected. In this simple example, step T2 of Fig. 3 is not taken into account, since all read messages belong to the same code family, defining that only one schema needs to be learned.

[0047] In the top right of Fig. 4, the lower and upper bounds of the ASCII codes of the characters that have appeared and been read so far are shown for each code position, corresponding to step T3 of Fig. 3. They are initialized with values ​​that are impossible for characters (e.g. [-1,-1]). The bounds are then modified with the characters measured for each position. For example, in the first line, a "J" with ASCII code 74 is read as the first character, and the lower bound is set to its value 74. In the second line, in the first position, a "J" appears again and is read, and the upper bound is also set to value 74. Alternatively, the first reading of a character in a position could place its value in the upper bound or in both bounds. The illustrated approach has the advantage that at least the first identification of a repetition of a value remains recognizable. Another parameter that counts the repetitions could then be added or coded in the bounds.

[0048] Later variable characters are treated exactly the same at the first reading of the character in that position. Any subsequent characters read at such a position either fall between known boundaries or overwrite the lower or upper bounds, so that the newly read character is now included in the subrange. For example, for the last character, the lower bound is first set to 48, the ASCII code for the read "0". In the second line, the upper bound is set to 54, the ASCII code for the read "6". After reading ten messages, we have a subrange [48,57] bounded by the ASCII codes for the digits "0" and "9", because these are the extreme values ​​that appear at this position in the ten messages.

[0049] The lower part of Figure 4 shows the schema generated by step T4 of Figure 3. To do this, the distribution obtained in step T3 for each message or schema position is evaluated. This distribution is shown in the last line in the upper right part of Figure 4. The string "JJD01460000" is always repeated in the first half of the read messages. This is the fixed part of the schema. This can be seen from the fact that the lower and upper bounds are the same in each of these positions, i.e. the same characters are read in each of the 10 messages.

[0050] The remaining second half of the message is the variant part. Here, the lower and upper bounds are different. Basically, for each variant character, the interval obtained by the lower and upper bounds can be used as is. However, it is preferable to generalize to classes and set the upper and lower bounds to the upper and lower boundaries of the class, respectively. For example, in the 12th position of the 10 messages in Figure 4, i.e., the first position of the variant part, only the digits "8" and "9" appear, so the subrange [56,57] is defined. However, we deviate from this original subrange to open the class and allow all digits in this position in the schema. Therefore, the subrange of the schema is [48,57].

[0051] It is conceivable that a character read at a certain position will exceed the class boundary. This can be a reason to stop training, since such a schema would be unreliable. An alternative is to allow multiple classes. In this case, the initially calculated boundary can be shifted to the boundary of the adjacent class below or above. This results in a connected subrange that spans several classes. In principle, separate classes are also conceivable, such as the numbers and lowercase letters that are separated from each other in the ASCII table in Figure 5. In that case, already when determining the subrange, it is necessary to check whether the newly read character exceeds the previous class boundary, and if so, to supplement two additional boundaries to include the new class. In this way, one of the classes of a variable character with multiple classes can be replaced by a single character. For example, in that case, this variable character allows numbers and the special character "+". It makes sense to make the classes just as large as necessary. The variable character should cover the characters that occur during operation, but the division should be as precise as possible under these conditions.

[0052] The schema of Fig. 4 has a fixed part at the beginning and a variable part at the end. The present invention is not limited to this, and multiple fixed parts and / or multiple variable parts can be arranged arbitrarily. In principle, it is possible to determine whether each position and character is a fixed character or a variable character, and there is no restriction in this regard.

[0053] 6 is an exemplary flow chart for checking and / or correcting a message read from an optical code based on a schema, at least one schema being predefined or learned in the manner described with reference to FIGS.

[0054] In step S1 an image containing the code field 20 is taken by the code reader 10. In step S2 the message contained in the code is read out by evaluating the image data in a decoder as described with reference to figure 1.

[0055] In step S3, a suitable scheme is assigned. This is determined based on the code length, the code type and / or a part of the message. In particular, a fixed part of the scheme can be used as a kind of fingerprint to identify codes that fit the scheme. Alternatively, there is only one scheme or one scheme is pre-defined and fixed. If no scheme fits the message, the further procedure shown in FIG. 6 is not applicable and is therefore interrupted or skipped in step S4. In that case, the read message is treated as if the present invention had not been present, i.e. the read message is output, the recognized errors are left as they are, or further corrections or checks can be made that are different from the corrections or checks of the present invention based on the scheme.

[0056] Using an appropriate schema, it is now possible to distinguish whether the message read in step S2 is a valid message or not - for this purpose, for example, a checksum can be referenced - in some cases, at least part of the message may be completely unreadable.

[0057] If the message is invalid, a correction based on the schema is attempted in step S5. For this, the fixed part of the schema is compared with the characters in the corresponding positions in the read message. Preferably, a minimum percentage of the fixed characters in the schema and in the read message should match, for example at least half, to be sufficiently sure that a code with a fixed part that matches the schema has really been read. If possible, such a check has already been made in step S3, so that it does not have to be repeated.

[0058] If the comparison is positive, the fixed part of the schema is transcribed into the message, overwriting the fixed characters of the message with the fixed characters of the schema, and interleaving characters if necessary to achieve the correct overall code length. Alternatively, it may be required that the code length of the message already matches the required code length of the schema before correction, in which case no interleaving characters are used.

[0059] The fixed part of the message is forced to be correct by the correction in step S5. However, it still remains possible that a minimum percentage match in the fixed part is not sufficient and the read code does not actually have that fixed part. However, in some cases the error is not only in the fixed part, but also in the variable part one or more characters are incorrectly decoded. To exclude such cases, the corrected message is checked again, for example based on a checksum. If this is successful, the corrected message is considered to be a correct reading. Otherwise, as explained at the beginning, a correction in the variable part can be attempted by checksum, but this approach is only limited in its power and reliability.

[0060] In the first correction example, the schema is the one studied in Figure 4, with a code length of 21, positions 1-11 containing the fixed part "JJD01460000", followed by the variable part consisting of numbers in positions 12-21. This schema will be referenced in all other correction examples. Now, as an example, the message "XJD023600009278066464" is read. The checksum is 18, and the bolded parts (the 1st, 5th and 6th characters) differ from the fixed part of the schema. The checksum based check is unsuccessful, so a correction is attempted and the fixed part, which clearly matches more than half, is transcribed into the read message, resulting in "JJD014600009278066464". Now the checksum is correct, so this is a valid message.

[0061] In the second correction example, suppose the message read is "D014600009278066464". The error this time is that the first two characters were not read, i.e. the leading "JJ" is missing. Therefore the message is two characters shorter than the required code length of 21. Therefore it is not a big deal if the checksum accidentally erroneously indicates a valid message. It is an independent second indicator. The match of the fixed part is still above the required minimum percentage of 50%. Therefore the fixed part of the schema can be inserted in the correct position. That is, the first two characters of the fixed part, "JJ", can be placed in front of the message read for correction. This will result in the code length of the message read having the correct value of 21, and the calculated checksum will now be correct.

[0062] In the third correction example, the original message is invalid because the checksum could not be read. This does not change the correction method in the first place. However, since no further checks can be made, only the code length can still be checked, the result is very unreliable. It is now possible to require repeated code reading. Since in some embodiments each code is otherwise read multiple times, it is then possible to increase the threshold corresponding to multiple successful decodings in order to be sufficiently confident that the character at the variable part position has been read without error.

[0063] Following the correction in step S5, a case test is then performed: if the correction does not allow a valid message to be reconstructed, step S6 remains with a read error (here NoRead). If the correction is otherwise successful, the process proceeds to step S7, which recognizes a misread. This step S7 is also reached according to the second case test following step S3, i.e. if the message was already valid without the correction in step S5. It should be noted that, deviating from FIG. 6, it would also be conceivable to always perform the correction in step S5 also for messages already valid in step S3, depending on whether a higher confidence is required in the original reading or schema of the message.

[0064] In step S7, a further misread is now recognized, if a valid message is read, with or without the corrections made in step S5, and in particular if the checksum calculated from the payload characters and the read checksum match, i.e. this validation is only reliable in the case of a single error, as already discussed at the beginning, whereas multiple errors may lead to the calculation of a correct checksum by chance.

[0065] First, optionally, if this has not already been done in steps S3 or S5, verify that the schema matches the message based on a comparison of fixed parts of the schema with characters in the message that correspond to the positions of those fixed parts, which must match to a minimum percentage (e.g. 50%).

[0066] For the variable part of the schema, it is checked whether the variable character of the read message is within the partial range of the schema at the position to which it belongs. For example, if the schema requires a number at a certain position, but a special character is read, the message will not be considered valid. In addition, it can be checked whether the code length of the schema is equal to the code length of the read message. If any message is not valid according to the criteria of step S7, the flow of FIG. 6 ends at step S6 with no valid read (MisRead in this case).

[0067] Otherwise, the message is considered valid. It is possible that the decoder was able to read it without error originally, or that the errors were corrected in step S5 and no misread was recognized in step S7. The message is either output in step S8 or further processed by steps already customary before the present invention.

[0068] The following examples of misreading recognition continue to use the schema learned in Figure 4. In the first, very simple example, the message "JJD014600005183211" is read, which is a misreading because it is 18 characters long and is shorter than the code length of the schema, which is 21.

[0069] In the second example, the message "JJD01460000MJ18321108" is read. This time the code length is correct, but the bolded parts (the 12th and 13th characters) are read as capital "MJ" instead of the numbers as per the schema. Again, this is a misreading.

[0070] In the third example, a misread occurs that cannot be found even with the action of step S7. Unlike fixed characters, variable characters have a certain amount of room for multiple errors to still complement each other and become the read checksum. In that case, the checksum may be read correctly, or it may itself be read incorrectly and be part of multiple errors. Now the correct message is "JJD014600009283279219" and the read message is "JJD014600009275279219", with the bolded digits (the 14th and 15th) corrected using the incorrectly read checksum. This error cannot be recognized. For one thing, the checksum matches, and its function is exhausted, so to speak, by the attempt to correct it. Moreover, it satisfies the schema because it incorporates digits. If the correction using the checksum had incorporated something other than digits, it would still have been found using the schema. In this third example, the read message is considered valid in step S8 even though it is actually a misread. Of course, it is possible that no correction using the checksum was attempted, in which case we would have only gotten a NoRead. As already discussed at the beginning, this risk is always present in the case of correction using the checksum, which increases the read rate (reducing NoReads), but at the same time increases the risk of a MisRead. The latter risk is at least further reduced by the scheme according to the invention.

[0071] It is useful to depict or represent a schema in a way that can be seen at a glance, traced and understood. This makes it easier to diagnose and possibly even manually optimize it, as well as to program the steps related to the schema in a systematic and error-free way. A simple implementation can be to associate subrange boundaries with positions in the schema, as in the example in Figure 4. This can be extended to boundaries of multiple classes and / or lists of allowed characters in subranges.

[0072] This can be expressed in pseudocode as follows, where the list of classes (Types) is extensible, specifically using the list in Figure 5:

[0073] Schema=Array of CodeCharSchema CodeCharSchema=List of SingleSchemaEntry SingleSchemaEntry= Record Type: (SingleCharacter, CharInterval) Value: Char; / * An individual character, e.g. a special character * / Min, Max: Char; / * This describes the interval * / End;

[0074] A further alternative for describing schemas is regular expressions, which reduce the definition of a schema to a precisely defined structure known to many users and for which standard components exist for design, editing and transformation. An example of a schema defined as a regular expression is "JJD...[az][az][0-9]...". This starts with the fixed part "JJD", followed by three arbitrary characters, followed by two lower case letters, a digit and three arbitrary characters again. Note, however, that not every regular expression can be a schema. For example, "^...[0-9]...$" contains the beginning of a line and the end of a line, but there can be no corresponding schema. The editor should not offer these possibilities at all in the first place, or at least suppress them with a warning.

[0075] It is conceivable that an alternative system or language of regular expressions could be designed for a schema, which could better suit the requirements of the schema. For example, uppercase letters could be represented by "C", lowercase letters by "c", numbers by "N", fixed characters could be enclosed in brackets, and free characters could again be represented by ".". The regular expression example above could then be written more compactly as "[JJD]...ccN...".

Claims

1. A computer-implemented method for reading an optical code (20) encoding a message having a string of characters, the method comprising: acquiring image data including said optical code (20); evaluating said image data to read said message; a step of comparing the characters of the read message with a schema, said schema comprising, for at least one position in said message, a fixed character expected at said position in the optical code (20) to be read; And, recognizing misinterpreted messages and / or correcting misinterpreted messages based on a comparison with said schema. In a method comprising: said schema comprising, for at least one position of said message, a variable character expected at said position in the optical code (20) to be read, said variable character being set over a subrange of possible characters but not a fixed character; the optical code (20) comprises a checksum, and validating the reading of the message based on the checksum; and using said checksum to correct any character at a variable character position that is not within the subrange of characters that the variable character can take or that is unreadable, and accepting the result as a correctly read message only if the corrected character is within the subrange of characters that the variable character can take. The method comprising:

2. 2. The method of claim 1, wherein the schema comprises a code length and / or includes one fixed character or one variable character per position.

3. 3. The method according to claim 1, further comprising selecting, from among a plurality of schemes, the scheme having a fixed set of characters that is most frequently found in the read message as the scheme to be applied.

4. 3. The method according to claim 1, further comprising carrying over the remaining fixed characters of the schema into the message if a minimum percentage, in particular at least half, of the fixed characters of the schema are correctly read in the message.

5. 3. A method according to claim 1 or 2, which classifies as misread a message having a length which does not match the length of the schema or which has a character in a variable character position which is not within the sub-range of characters which the variable character can take.

6. 3. The method according to claim 1 or 2, wherein the schema comprises at least one of the following subranges of characters that the variant characters can take, in particular according to the ASCII code: non-printable characters, special characters, numbers, phonetic characters, lowercase letters and uppercase letters.

7. The method of claim 1 or 2, wherein the schema is expressed as a regular expression indicating permissible characters for each position.

8. 2. The method of claim 1, further comprising evaluating a large number of read messages to learn the schema, in particular by obtaining the read messages on-the-fly or by reading them from a log file.

9. The method of claim 8 , wherein the schema is learned from a distribution of read characters at each position of the read message.

10. 10. A method according to claim 8 or 9, wherein in positions where the same character is always read, a corresponding fixed character is learned, and in positions where various characters are read, a subrange formed by these characters is learned as a variable character.

11. 10. A method according to claim 8 or 9, wherein the schema is first initialized position by position with an empty area, each time storing for a position the first character read at that position, and if a character read at a position after the first character for that position is a character not yet known for that position, then expanding the subrange for that position to include the read character.

12. 1. A photoelectric code reader (10) comprising at least one light receiving element (24) for generating image data from received light, and a control and evaluation unit (26) in which the method for reading an optical code (20) according to claim 1 is implemented.

Citation Information

Patent Citations

  • Method for reading an optical code

    EP3428835B1

  • Id card issuing system

    JP2002288592A

  • Photoelectric code reader, and method of reading photoelectric code

    JP2019049967A

  • Read-in device, read-in result output method, and program

    WO2013179436A1