【0001】
【産業上の利用分野】
本発明は、手動で走査する為に、安定した読み取りが期待できないバーコード読み取り装置において、バーコードイメージを構成するエレメント毎の幅の太、細を判断し、そのエレメント毎の幅の太、細の並びの構成からキャラクターを解析して、バーコードを読みとるバーコード読み取り装置に関するものである。
【0002】
【従来の技術】
従来のバーコード種類としては、2値レベルコードとマルチレベルコードが知られている。2値レベルコードは太いエレメントと細いエレメントで構成されており、幅値について2レベルの値を持っている。この種のコードは、CODABAR(NW−7)、2of5、CODE39等が知られている。そして各エレメントが、太いか細いかをエレメント群より算出したしきい値と比較することによって判断し、その太、細の並び順で各キャラクタを判断するバーコード読み取り装置が知られている。
【0003】
例えばCODABARのバーコード情報は、図3に示す様に1つのキャラクタが、4本のバーとそれにはさまれた3本のスペースの合計7本のエレメントで構成され、内2本が太いエレメントであるが、最初と最後のキャラクタとして付加されるスタート・ストップコード(A〜D)は3本が太いエレメントである。従来、こうしたバーコードをデコードする際の各エレメントに対する太、細判断の一例として7本のエレメントからなるキャラクタの全長幅をTとし、エレメント毎の幅を太が2、細が1と想定しスタートコードに反映させると2×3本+1×4本=10となり、細いエレメント幅はN=T÷10、しきい値は太と細の間であるからS=N×1.5として、各エレメントの幅をしきい値Sと比較してエレメント幅>Sの場合に太いとし、他は細いと判断するものが知られている。また別のしきい値Sの算出方法として7本のエレメント中最大と最小のエレメントを探し、結果最大のエレメントは太、最小のエレメントは細であることは明白であり、二つの平均値をしきい値として、比較して各エレメントを判断していた。
【特許文献】
特開平1−156886号
特開平5−101214号
【0004】
【発明が解決しようとする課題】
しかしながら、上述した従来の技術では、バーコードの走査が手動である場合に、バーコードの印刷に対して取り込んだエレメントの幅が安定せず、また途中からなぞることでキャラクタ単位での抜け等が発生し、誤読が発生するという問題がある。誤読の具体例としては太いエレメントが20、細いエレメントが10として構成されるCODABARで、スタートコードをとばしてキャラクタの「4」から走査した結果、各エレメントが8,8,18,14,10,21,12になったとする。この場合に先頭はスタート・ストップコードとしてしきい値を求めることになり合計が91から13.65となり細エレメントであるはずの14が、太エレメントと判断されてしまう。そのため該当するキャラクタが「A」となりスタート・ストップコードと一致しデコードできなく、結果誤読となってしまう。
【0005】
【課題を解決するための手段】
そこで本発明では、バーコードの構成を考慮しCODABARであれば、デコード成功後に先頭にあるキャラクタのエレメントに対してスタート・ストップコードではないものとして、再度デコードしてデコードに成功した場合に先頭がスタート・ストップコードではないことになり、当初デコードに成功したものは誤読であると判断し破棄することで、正確な読み取りを可能にする。
【0006】
【作用】
本発明ではバーコード読み取り後、バーコードの種類に応じて別途エレメント毎の判別を行うことで、誤読を低減できるバーコード読み取り装置を提供する。
【0007】
【実施例】
以下、本発明の詳細を添付図面を参照して説明する。図1は本発明のバーコード読み取り装置外観図と使用例である。図2は内部のブロック図を示す。図3にはCODABARのキャラクター例と対応するイメージパターンと装置内テーブルデータ、図4は誤読しやすいコードの例、図5は走査時に取り込まれる信号とエレメントの幅にを表したもの、図6はエレメントの幅を数値化したサンプルデータ、図7は算出したそれぞれのしきい値、図8はしきい値から判断したエレメントの太細の表である。
【0008】
次に実際の動作を図を参照しながら説明する。バーコード読み取り装置1を手で持ちバーコード2をなぞることで読み取りが開始される。CPU3はROM4に格納された制御ソフトと実行に必要なデータを格納するRAM5に従って、LED駆動回路を動作させ照明用のLED11を点灯させ、その反射光をレンズ10で集光しセンサ9へ送りバーコード信号受信回路でデジタル信号化する。この時、図5に示す波形がCPU3に取り込まれ、バーコードの白い部分でHIGH、黒い部分でLOWを出力するものとしてデジタル変換された信号の切り替わり時間をタイマ6で計測し保存する。ここで得られた値は、各エレメントの幅値データである。
【0009】
次にCPU3はバーコード2の解析を行う。バーコード2解析処理の例として、CODABARで決められているバーコードを用いたキャラクタをデコードする様子を、図9のデコード概略フローにそって説明する。まずCODABARの特徴を簡単に説明すると、1つのキャラクタが4本のバーとそれにはさまれた3本のスペースの合計7本のエレメントで構成され、内2本が太いエレメントであるが、最初と最後のキャラクタとして付加されるスタート・ストップコード(A〜D)は3本が太いエレメントである。図3に、CODABARにおけるバーコードのキャラクタと、構成パターンをイメージとして図にしたものとの対応関係を表したものを抜粋して示す。またCPU3が参照するテーブルデータをバイナリとして列挙した。太いエレメントは「1」、細いエレメントは「0」にコード化されデータテーブル(図示せず)としてROM4に格納されている。キャラクタとしては数字、記号、スタート・ストップコード(A〜D)がある。
【0010】
ここでスタート・ストップコードとそれ以外のコードを比較した場合、図4に示す例のように1つのエレメントのみの太さが違うだけであり、誤読の可能性が大きい関係である。デコード処理の開始として1キャラクター分のエレメント幅を取り込む(S1)。(以下、(S1)の様に書いた箇所は、CPU3の処理の順番を示したものであるので、図9を参照されたい。)そこで例としてCODABARでのコード「4」と「A」のバーコードをなぞった場合に、取り込まれた信号から各エレメントの幅データを検出した結果の値を一覧にしたものを図6に示す。ここでバーコード読み取り装置1で正常に走査出来れば、サンプル3のデータが取り込まれるが場所がずれた場合、先頭には無いサンプル1及び2のデータが先頭として取り込まれる可能性もある。
【0011】
次にCPU3は処理(S3)として各エレメントの幅値から太、細を判断する為のしきい値を算出しなければならない。しきい値としてはスタート・ストップコードであれば太細が2対1の比率の場合に太3本、細4本であるから1キャラクタで細を基準とした全体の比は2×3+1×4=10となり1キャラクタ分のエレメント幅値の合計を10で割ったものが細の幅に相当するので、太い細いを判断するしきい値としては間の値が必要となり1.5倍することで最終のしきい値を算出する。
【0012】
同様にスタート・ストップコード以外では太2本、細5本であるから1キャラクタで細を基準とした全体の比は、2×2+1×5=9となり1キャラクタ分のエレメント幅値の合計を9で割ったものが、細の幅に相当し1.5倍することで最終のしきい値となる。その参考しきい値として、1キャラクタのサイズに関係なく太りや細りの影響を受けにくいように、エレメント幅の中で最大、最小から2番目のエレメントを抽出する。これが必ず太いエレメント、細いエレメントとなるので2つの平均を求めればしきい値となる。以上の算出を図6に示すサンプルに対して行った結果が図7の表となる。
【0013】
次に図7に示すしきい値を用いて、図6に示すサンプルの各エレメント幅に対してしきい値より大きければ太、小さければ細と判断(S3)した結果が図8の表となり、図3のデータと照合した結果一致するキャラクタがあればデコード成功となり、無ければ違う種類のバーコードまたはバーコードで無いと判断(S4)する事になる。今回の例のサンプルにおいてはサンプル1の「4」が先頭にあった場合は13.65がしきい値となり「A」と判断されCODABARにおいて先頭が「A」であることは特徴と一致するので判断が正常となってしまう。またスタート・ストップコードとそれ以外の区別なく太、細の平均値から求めたしきい値13を用いても同じ結果となり、最終デコード結果は「A」となり(S6)実際には誤読であるがバーコードが特定されてしまう(S6)。
【0014】
そこでステップS7であえて先頭にあるエレメント幅に対してバーコードの構成と違うスタート・ストップコード以外に対応したしきい値15.16を用いて判断を行う。その結果として「4」と一致する(S8)事から、スタート・ストップコードであるべきところが違っている事が判断でき、この当初のデコード結果を破棄(S10)することで誤読が回避できる。ここで正規のスタート・ストップコードに対して、それ以外のコードに対応したしきい値を用いて判断した結果、キャラクタとして一致するものが無い場合は当初の判読結果の「A」が正解と判断できる(S9)。サンプル2及び3の判断結果は、どのしきい値を用いても「4」と「A」となるので「4」が先頭にあればCODABARの特徴に一致しないので破棄、「A」ならば正解となり確定したキャラクタをもってデコードを終了する。
【0015】
【発明の効果】
本発明では、一度読み取りに成功したバーコードに対して読みとったバーコードの構成から、はずれるしきい値を算出して用いた結果構成からはずれるデータ読みとれてしまった場合に、当初の読み取りに成功したバーコードデータを破棄することで誤読が回避でき、結果読み取り精度の向上につながる効果がある。
【図面の簡単な説明】
【図1】バーコード読み取り装置外観概略図
【図2】バーコード読み取り装置ブロック図
【図3】CODABAR構成表
【図4】誤読例
【図5】バーコードデジタル信号計測図
【図6】エレメント計測幅値例一覧表
【図7】しきい値算出例一覧表
【図8】判断結果例一覧表
【図9】デコード処理フロー図
【符号の説明】
1 バーコード読み取り装置外観
2 バーコード
3 CPU
4 ROM
5 RAM
6 タイマ
7 バーコード信号受信回路
8 LED駆動回路
9 光学センサ
10 レンズ
11 LED[0001]
[Industrial applications]
According to the present invention, in a barcode reading apparatus in which stable reading cannot be expected because of manual scanning, the width and the width of each element constituting a barcode image are determined, and the width and the width of each element are determined. The present invention relates to a bar code reading device that reads a bar code by analyzing a character from the arrangement of the characters.
[0002]
[Prior art]
As conventional barcode types, a binary level code and a multilevel code are known. The binary level code is composed of a thick element and a thin element, and has two levels of width values. Codes of this type include CODEBAR (NW-7), 2of5, and CODE39. A bar code reader is known which determines whether each element is thick or thin by comparing it with a threshold value calculated from an element group, and determines each character in the order of the thick and thin.
[0003]
For example, as shown in FIG. 3, in the bar code information of CODEBAR, one character is composed of four bars and three spaces sandwiched therebetween, for a total of seven elements, two of which are thick elements. However, three start / stop codes (A to D) added as the first and last characters are thick elements. Conventionally, when decoding such a barcode, as an example of judging the width and fineness of each element, it is assumed that the total width of a character composed of seven elements is T, the width of each element is 2 and the width is 1 and the start is made. When reflected in the code, 2 × 3 + 1 + 1 = 10, the narrow element width is N = T ÷ 10, and the threshold value is between thick and thin, so S = N × 1.5. Is compared with a threshold value S, and when the element width is greater than S, it is known that the width is large and the others are narrow. As another method of calculating the threshold value S, the maximum and minimum elements are searched for among the seven elements. As a result, it is clear that the maximum element is thick and the minimum element is thin. Each element was determined by comparison as a threshold value.
[Patent Document]
JP-A-1-156886 JP-A-5-101214
[Problems to be solved by the invention]
However, according to the above-described conventional technology, when barcode scanning is manual, the width of an element captured for barcode printing is not stable. And there is a problem that misreading occurs. A specific example of misreading is a CODABAR composed of 20 thick elements and 10 thin elements. As a result of skipping the start code and scanning from "4" of the character, each element is 8, 8, 18, 14, 10, and It is assumed that the number has reached 21 and 12. In this case, the threshold value is obtained as a start / stop code at the head, and the total is changed from 91 to 13.65. Thus, 14 which is supposed to be a thin element is determined to be a thick element. Therefore, the corresponding character becomes "A" and matches the start / stop code and cannot be decoded, resulting in erroneous reading.
[0005]
[Means for Solving the Problems]
Therefore, in the present invention, if the code is CODEBAR in consideration of the configuration of the barcode, it is assumed that the element of the character at the head after decoding is not a start / stop code, and if the decoding is successful and the decoding is successful, the head is Since it is not a start / stop code, a code that has been successfully decoded at first is judged to be erroneous and discarded, thereby enabling accurate reading.
[0006]
[Action]
The present invention provides a barcode reading device that can reduce erroneous reading by separately determining each element according to the type of barcode after reading the barcode.
[0007]
【Example】
Hereinafter, the present invention will be described in detail with reference to the accompanying drawings. FIG. 1 is an external view of a barcode reading device of the present invention and an example of use. FIG. 2 shows an internal block diagram. FIG. 3 shows an image pattern and table data in the apparatus corresponding to the character example of CODABAR, FIG. 4 shows an example of a code which is easily misread, FIG. 5 shows a signal taken in at the time of scanning and the width of an element, and FIG. FIG. 7 shows sample data obtained by digitizing the width of the element, FIG. 7 shows each calculated threshold value, and FIG. 8 shows a thick and thin table of the element determined from the threshold value.
[0008]
Next, the actual operation will be described with reference to the drawings. Reading is started by holding the barcode reader 1 and tracing the barcode 2 by hand. The CPU 3 operates the LED driving circuit to turn on the LED 11 for illumination in accordance with the control software stored in the ROM 4 and the RAM 5 which stores data necessary for execution, and condenses the reflected light by the lens 10 and sends it to the sensor 9. It is digitized by a code signal receiving circuit. At this time, the waveform shown in FIG. 5 is captured by the CPU 3, and the switching time of the digitally converted signal is measured and stored by the timer 6 assuming that the white portion of the barcode outputs HIGH and the black portion outputs LOW. The value obtained here is the width value data of each element.
[0009]
Next, the CPU 3 analyzes the barcode 2. As an example of the barcode 2 analysis processing, how to decode a character using a barcode determined by CODEBAR will be described with reference to the schematic decoding flow in FIG. First, the characteristics of CODABAR will be briefly described. One character is composed of four bars and three spaces sandwiched between the bars, for a total of seven elements, two of which are thick elements. Three start / stop codes (A to D) added as the last character are thick elements. FIG. 3 shows an excerpt of the correspondence between the barcode character in the CODEBAR and the image of the configuration pattern as an image. Table data referred to by the CPU 3 is listed as binary. Thick elements are coded as "1" and thin elements are coded as "0" and stored in the ROM 4 as a data table (not shown). The characters include numbers, symbols, and start / stop codes (A to D).
[0010]
Here, when the start / stop code is compared with the other codes, only the thickness of one element is different as in the example shown in FIG. 4, and the possibility of misreading is large. As the start of the decoding process, the element width of one character is fetched (S1). (Hereinafter, the portion written as (S1) indicates the order of processing by the CPU 3, so please refer to FIG. 9.) Therefore, as an example, the code “4” and the code “A” in the CODEBAR are used. FIG. 6 shows a list of values obtained as a result of detecting width data of each element from a fetched signal when a bar code is traced. Here, if the barcode reading device 1 can scan normally, the data of the sample 3 is taken in, but if the position is shifted, the data of the samples 1 and 2 which are not at the top may be taken as the top.
[0011]
Next, the CPU 3 has to calculate a threshold value for judging thick or thin from the width value of each element as the process (S3). As the threshold value, in the case of a start / stop code, in the case of a ratio of 2: 1 thick and thin, there are 3 thick lines and 4 thin lines. Therefore, the overall ratio of one character to the thin line is 2 × 3 + 1 × 4. = 10, and the sum of the element width values for one character divided by 10 corresponds to the fine width. Therefore, a threshold value for judging whether the character is thick or thin requires an intermediate value. Calculate the final threshold.
[0012]
Similarly, except for the start / stop code, the width is 2 thick and 5 thin, so the overall ratio of one character to the fine is 2 × 2 + 1 × 5 = 9, and the total element width value for one character is 9 The value obtained by dividing by 1.5 corresponds to the narrow width, and is multiplied by 1.5 to become the final threshold value. As a reference threshold value, the second element from the largest and the smallest element in the element width is extracted so as to be hardly affected by fatness and thinning regardless of the size of one character. Since this is necessarily a thick element and a thin element, a threshold value is obtained by calculating the average of the two. The result of performing the above calculation for the sample shown in FIG. 6 is shown in the table of FIG.
[0013]
Next, using the threshold values shown in FIG. 7, for each element width of the sample shown in FIG. 6, if the value is larger than the threshold value, it is determined that the width is large, and if it is smaller, the result is determined to be thin (S3). If there is a matching character as a result of collation with the data in FIG. 3, decoding is successful, and if not, it is determined that the barcode is not a different type of barcode or a barcode (S4). In the sample of this example, when "4" of sample 1 is at the top, 13.65 becomes the threshold value and it is determined to be "A", and the fact that the top is "A" in CODABAR matches the feature. The judgment becomes normal. Also, the same result is obtained by using the threshold value 13 obtained from the average value of the start and stop codes and the thick and thin without distinction, and the final decoding result is "A" (S6). The barcode is specified (S6).
[0014]
Therefore, in step S7, a judgment is made using a threshold value 15.16 corresponding to a start / stop code other than the barcode configuration for the leading element width. As a result, since it coincides with "4" (S8), it can be determined that what should be the start / stop code is different, and misreading can be avoided by discarding the initial decoding result (S10). Here, as a result of using the thresholds corresponding to the other codes for the normal start / stop codes, if there is no match as a character, the initial interpretation result "A" is determined to be correct. Yes (S9). The judgment results of samples 2 and 3 are "4" and "A" regardless of the threshold value, so if "4" is at the beginning, it does not match the features of CODEBAR, so discard it. If "A", the answer is correct. The decoding is completed with the determined character.
[0015]
【The invention's effect】
According to the present invention, when data is read out of the configuration as a result of calculating and using a threshold value that deviates from the configuration of the bar code read once for the bar code that has been successfully read, the initial reading was successful. By discarding the barcode data, erroneous reading can be avoided, and this has the effect of improving the accuracy of reading the result.
[Brief description of the drawings]
FIG. 1 is a schematic view of an external appearance of a bar code reading device. FIG. 2 is a block diagram of a bar code reading device. FIG. 3 is a CODEBAR configuration table. FIG. 4 is an example of misreading. FIG. 5 is a bar code digital signal measurement diagram. Width value example list [FIG. 7] Threshold value calculation example list [FIG. 8] Judgment result example list [FIG. 9] Decoding process flow chart [Description of symbols]
1 Bar code reader appearance 2 Bar code 3 CPU
4 ROM
5 RAM
6 Timer 7 Barcode signal receiving circuit 8 LED driving circuit 9 Optical sensor 10 Lens 11 LED