JP2015176425A - Bar code reading device, bar code reading method, and bar code reading program - Google Patents

Bar code reading device, bar code reading method, and bar code reading program Download PDF

Info

Publication number
JP2015176425A
JP2015176425A JP2014053290A JP2014053290A JP2015176425A JP 2015176425 A JP2015176425 A JP 2015176425A JP 2014053290 A JP2014053290 A JP 2014053290A JP 2014053290 A JP2014053290 A JP 2014053290A JP 2015176425 A JP2015176425 A JP 2015176425A
Authority
JP
Japan
Prior art keywords
pixel
black
white
barcode
light intensity
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.)
Granted
Application number
JP2014053290A
Other languages
Japanese (ja)
Other versions
JP5896488B2 (en
Inventor
芦浦 敦
Atsushi Ashiura
敦 芦浦
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.)
NEC Platforms Ltd
Original Assignee
NEC Platforms 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 NEC Platforms Ltd filed Critical NEC Platforms Ltd
Priority to JP2014053290A priority Critical patent/JP5896488B2/en
Publication of JP2015176425A publication Critical patent/JP2015176425A/en
Application granted granted Critical
Publication of JP5896488B2 publication Critical patent/JP5896488B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

PROBLEM TO BE SOLVED: To improve minimum resolution of bar code reading without increasing the number of pixels of an image sensor for bar code reading.SOLUTION: A bar code reading device includes a processor for binarizing an image-capture image for each pixel according to reception light intensity of each pixel of an image sensor image-capturing the bar code. The processor determines that there exist boundaries of a white part and a black part of the bar code within an object pixel when the reception light intensity of the object pixel of the binarization process assumes an intermediate value between a first reception intensity when one whole pixel is equivalent to the white part of the bar code and a second reception light intensity when one whole pixel is equivalent to a black part of the bar code, and a black and white order inside the object pixel and the boundary position is determined based on the object pixel and the increase/decrease relation of the reception light intensity in the adjacent pixel.

Description

本発明はバーコード読取装置、バーコード読取方法及びバーコード読取プログラムに関し、特に、バーコード読み取りにおける二値化方法に関する。   The present invention relates to a barcode reading apparatus, a barcode reading method, and a barcode reading program, and more particularly to a binarization method in barcode reading.

バーコード読取装置(以下「バーコードスキャナ」ともいう)により、各種の製品や管理の対象物などに印刷されるか又はラベルで貼付されたバーコードが読み取られる。バーコードは、種々の太さの線とその間隔の並びによって数字、文字、記号などを表現した符号である。一般に線の色は黒で、線間の色は白であるが、明暗を識別できる色であれば白と黒に限定されない。以下では、暗部である線の部分を「黒部」といい、明部である線間部分を「白部」という。   A bar code reader (hereinafter also referred to as “bar code scanner”) reads bar codes printed on various products or management objects or attached with labels. A bar code is a code that represents numbers, characters, symbols, and the like by lines of various thicknesses and their intervals. In general, the color of the line is black and the color between the lines is white. However, the color is not limited to white and black as long as the color can be distinguished. In the following, the portion of the line that is the dark portion is referred to as “black portion”, and the portion of the line that is the bright portion is referred to as “white portion”.

バーコード読取装置はバーコードの映像を受光するイメージセンサを備える。このバーコード読取装置には、イメージセンサで受けたバーコード画像の白部及び黒部の幅を検出できる限界(最小分解能)が存在する。通常はその限界を超えた細かい白部や黒部を含むバーコードでは、白部と黒部を適切に切り分けられないので、バーコードの読み取りは不可能である。   The barcode reader includes an image sensor that receives a barcode image. This barcode reader has a limit (minimum resolution) that can detect the width of the white and black portions of the barcode image received by the image sensor. Normally, a barcode including a fine white portion or black portion exceeding the limit cannot properly separate the white portion and the black portion, so that the barcode cannot be read.

例えば、バーコード読取装置に搭載された1次元イメージセンサの画素が1000ピクセルで、そのバーコード読取装置の読取可能なバーコード幅が60mmとすれば、バーコード読取装置のイメージセンサの1画素あたりに換算すると、見かけの分解能は60mm/1000ピクセル、即ち0.06mm/ピクセルに相当することになる。   For example, if the pixel of the one-dimensional image sensor mounted on the barcode reader is 1000 pixels and the barcode width that can be read by the barcode reader is 60 mm, the pixel per pixel of the image sensor of the barcode reader In other words, the apparent resolution corresponds to 60 mm / 1000 pixels, that is, 0.06 mm / pixel.

しかし、バーコードの映像がセンサ画素幅に対して、ちょうど1対1となるようなことは現実的にはあり得ず、白部と黒部の境界部が映像としてイメージセンサの1つの画素に映り込むような状態が発生する。この状態における当該画素での受光強度は、画素全体が白部のときの受光強度と画素全体が白部のときの受光強度との中間の値をとる。一般に、その中間の値が或る閾値より白部の受光強度に近ければ白と、黒部の受光強度に近ければ黒と判断されていた。このような処理の結果、本来のバーコード像(以下「バーコード原像」ともいう)の黒部の幅がバーコード読取装置ではより太く認識されたり、より細く認識されたりするため、バーコード原像に比して二値化後の白部及び黒部の幅に誤差が発生していた。この誤差によって、白部と黒部の適切な幅を検出できず、結果的にバーコードのデコードに失敗することがあった。   However, it is practically impossible for the barcode image to be exactly one-to-one with respect to the sensor pixel width, and the boundary between the white portion and the black portion appears as one image on one pixel of the image sensor. Will occur. The light reception intensity at the pixel in this state takes an intermediate value between the light reception intensity when the entire pixel is a white portion and the light reception intensity when the entire pixel is a white portion. In general, when the intermediate value is closer to the received light intensity of the white portion than a certain threshold, it is determined to be white, and when the intermediate value is closer to the received light intensity of the black portion, it is determined to be black. As a result of such processing, the width of the black portion of the original barcode image (hereinafter also referred to as “barcode original image”) is recognized thicker or more finely by the barcode reader, so that the barcode original is recognized. There was an error in the width of the white part and black part after binarization compared to the image. Due to this error, an appropriate width between the white portion and the black portion cannot be detected, and as a result, decoding of the barcode may fail.

この様な事情から、一般的にはイメージセンサの3画素分程度の幅、本例では、0.06mm×3=0.18mmが白部と黒部を適切に切り分けられる限界(すなわち最小分解能)とされている。   For this reason, generally the width of about 3 pixels of the image sensor, in this example, 0.06mm x 3 = 0.18mm is the limit (that is, the minimum resolution) that can properly separate the white part and the black part. Yes.

次に、閾値を用いて画素毎に白部と黒部を判定する従来技術の二値化方法について図13及び図14を参照して説明する。   Next, a conventional binarization method for determining a white portion and a black portion for each pixel using a threshold will be described with reference to FIGS. 13 and 14.

図13(A)はバーコードラベル11を示す。バーコードラベル11は、黒と白を同じ幅で等間隔に並べたバーコードを模している。図13(B)はこのバーコードラベル11の一部12を示す。図13(C)は画素番号0〜7までの画素をもつイメージセンサ13を示す。このイメージセンサ13上にバーコードラベルの像が結像した状態を考える。イメージセンサ13の画素の幅を1とした場合、ラベルの一部12の黒部の幅は4.2である。図13(C)に示されるように、ラベルの一部12の黒部がイメージセンサ13の画素1〜5にかけて、網掛け部で示したように投影されているとする。このとき、イメージセンサ13の画素1は白部が0.6、画素5は白部が0.2の幅で映る。   FIG. 13A shows the bar code label 11. The barcode label 11 imitates a barcode in which black and white are arranged at equal intervals with the same width. FIG. 13B shows a part 12 of the barcode label 11. FIG. 13C shows the image sensor 13 having pixels of pixel numbers 0 to 7. Consider a state in which an image of a bar code label is formed on the image sensor 13. When the pixel width of the image sensor 13 is 1, the width of the black portion of the part 12 of the label is 4.2. As shown in FIG. 13C, it is assumed that the black portion of the part 12 of the label is projected over the pixels 1 to 5 of the image sensor 13 as shown by the shaded portion. At this time, the pixel 1 of the image sensor 13 is projected with a white portion of 0.6 and the pixel 5 is projected with a width of 0.2.

図13(D)は、画素全体が黒部のときの受光強度を0、画素全体が白部のときの受光強度を1とした場合に、イメージセンサ13の各画素0〜7での受光強度分布を示したグラフ14である。従来技術の二値化方法では、この受光強度分布に対して閾値を設けて、受光強度がその値を超えるものを白、下回るものを黒とする。図13(D)の例では閾値を0.5と設定して二値化している。   FIG. 13D shows the received light intensity distribution at each pixel 0 to 7 of the image sensor 13 when the received light intensity is 0 when the entire pixel is a black portion and the received light intensity is 1 when the entire pixel is a white portion. It is the graph 14 which showed. In the binarization method of the prior art, a threshold value is provided for this received light intensity distribution, and when the received light intensity exceeds that value, white is set, and when the received light intensity is lower, black is set. In the example of FIG. 13D, the threshold value is set to 0.5 and binarized.

図13(E)は、上記の二値化により得られた白・黒のパターン17を示す。イメージセンサ13に映る映像の黒部の幅は4.2であったものが、二値化処理後の白・黒のパターン17では4となっている。この段階で、バーコード原像に対する二値化後の誤差は−5%となる。図13の例では原像12の黒部の幅が、センサ画素数の4ピクセル分以上あるため、原像12に対する二値化後の黒部の幅の誤差は比較的小さく、閾値0.5によって二値化したこの例の結果は、以後のデコード処理に利用可能なデータになる。   FIG. 13E shows a white / black pattern 17 obtained by the above binarization. The width of the black portion of the image projected on the image sensor 13 is 4.2, but is 4 in the white / black pattern 17 after the binarization process. At this stage, the error after binarization with respect to the barcode original image becomes −5%. In the example of FIG. 13, since the width of the black portion of the original image 12 is equal to or more than the number of sensor pixels, the error in the width of the black portion after binarization with respect to the original image 12 is relatively small, and binarization is performed with a threshold value of 0.5. The result of this example is data that can be used for subsequent decoding processing.

一方、次に図14の場合を考える。図14(A)はこの例で用いられるバーコードラベル21を示す。バーコードラベル21は、図13(A)のバーコードラベル11と同様に、黒と白を同じ幅で等間隔に並べたバーコードを模している。図14(B)はこのバーコードラベル21の一部22を示す。図14(C)は画素番号0〜7までの画素をもつイメージセンサ23を示す。このイメージセンサ23上にバーコードラベルの像が結像した状態を考える。イメージセンサ23の1画素分の幅を1とした場合、ラベルの一部22の黒部の幅は1.4である。図14(C)に示されるように、ラベルの一部22の黒部が網掛け部で示したように投影されているとする。   On the other hand, consider the case of FIG. FIG. 14A shows a bar code label 21 used in this example. As with the barcode label 11 in FIG. 13A, the barcode label 21 is a barcode in which black and white are arranged at equal intervals with the same width. FIG. 14B shows a part 22 of the barcode label 21. FIG. 14C shows an image sensor 23 having pixels with pixel numbers 0 to 7. Consider a state in which an image of a bar code label is formed on the image sensor 23. When the width of one pixel of the image sensor 23 is 1, the width of the black portion of the part 22 of the label is 1.4. As shown in FIG. 14C, it is assumed that the black portion of the part 22 of the label is projected as shown by the shaded portion.

図14(D)は、画素全体が黒部のときの受光強度を0、画素全体が白部のときの受光強度を1とした場合に、イメージセンサ23の各画素0〜7での受光強度分布を示したグラフ24である。図14(D)の例でも閾値を0.5と設定して二値化している。   FIG. 14D shows the received light intensity distribution at each pixel 0 to 7 of the image sensor 23 when the received light intensity is 0 when the entire pixel is a black portion and the received light intensity is 1 when the entire pixel is a white portion. It is the graph 24 which showed. In the example of FIG. 14D, the threshold is set to 0.5 and binarized.

図14(E)は、上記の二値化により得られた白・黒のパターン27を示す。二値化後のパターン27の黒部に注目すると、幅が1のものと2のものが生じているのが分かる。これは、原像22では同じ幅の黒部が、二値化後に同じ幅と識別されずに不均一となっていることを意味している。図14の例の場合は、同じ幅1.4であるはずの黒部が1又は2の幅となっており、原像に対してはそれぞれ誤差−30%、+43%となる。しかも、二値化後の状態を基準にすると、幅1のものが幅2にもなりうる、つまり誤差100%となる。これでは後段のデコード処理で利用できない(このまま処理をしても確実にデコードに失敗する)。   FIG. 14E shows a white / black pattern 27 obtained by the above binarization. When attention is paid to the black portion of the binarized pattern 27, it can be seen that the width 1 and the width 2 are generated. This means that in the original image 22, the black portion having the same width is not identified as the same width after binarization and is nonuniform. In the example of FIG. 14, the black portion that should have the same width of 1.4 has a width of 1 or 2, and has an error of −30% and + 43% with respect to the original image, respectively. In addition, when the binarized state is used as a reference, the width 1 can be the width 2, that is, the error is 100%. This cannot be used in the subsequent decoding process (decoding fails without fail even if the process is performed as it is).

この問題を技術的に解決するためには、バーコード読取装置に搭載するイメージセンサを、より画素数の多いものに変更する、という方法が一般的である。しかし、この方法では、画素数の多いイメージセンサはより高価であり、またそれにより処理すべき画素のデータ量が増加すると、より高性能なプロセッサを必要とするなど、ハードウェアのコストが上昇してしまう点や、画素数の多いイメージセンサ自体に技術的或いは製造上の限界が存在する点などが課題となっていた。
尚、特許文献1には、光学的情報読取装置において、見かけ上の分解能を向上させる一方法が開示されている。
In order to technically solve this problem, a general method is to change the image sensor mounted on the barcode reader to one having a larger number of pixels. However, with this method, an image sensor with a large number of pixels is more expensive, and if the amount of pixel data to be processed thereby increases, the cost of hardware increases, such as requiring a higher-performance processor. The problem is that the image sensor itself having a large number of pixels has technical or manufacturing limitations.
Note that Patent Document 1 discloses a method for improving the apparent resolution in an optical information reading apparatus.

特開平06−251194号公報Japanese Patent Laid-Open No. 06-251194

本発明の目的は、バーコード読取用のイメージセンサの画素数を増すことなく、最小分解能を向上させたバーコード読取装置、バーコード読取方法及びバーコード読取プログラムを提供することにある。   An object of the present invention is to provide a bar code reading apparatus, a bar code reading method, and a bar code reading program in which the minimum resolution is improved without increasing the number of pixels of an image sensor for reading bar codes.

本発明の第1の観点によるバーコード読取装置は、バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理するプロセッサを備え、前記プロセッサは二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とする。   A barcode reader according to a first aspect of the present invention includes a processor that binarizes a captured image for each pixel according to the received light intensity of each pixel of an image sensor that has captured the barcode, and the processor is binary. If the light reception intensity of the target pixel of the conversion processing takes an intermediate value between the first light reception intensity when the entire pixel corresponds to the white portion of the barcode and the second light reception intensity when it corresponds to the black portion, the target It is determined that there is a boundary between the white portion and the black portion of the barcode in the pixel, and the order of black and white and the boundary in the target pixel based on the relationship between the increase and decrease in received light intensity in the target pixel and its adjacent pixels and the intermediate value The position is determined.

本発明の第2の観点によるバーコード読取方法は、バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理するステップを含み、前記ステップにおいて二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とする。   The barcode reading method according to the second aspect of the present invention includes a step of binarizing a captured image for each pixel in accordance with the received light intensity of each pixel of the image sensor that has captured the barcode, If the light reception intensity of the target pixel of the conversion processing takes an intermediate value between the first light reception intensity when the entire pixel corresponds to the white portion of the barcode and the second light reception intensity when it corresponds to the black portion, the target It is determined that there is a boundary between the white portion and the black portion of the barcode in the pixel, and the order of black and white and the boundary in the target pixel based on the relationship between the increase and decrease in received light intensity in the target pixel and its adjacent pixels and the intermediate value The position is determined.

本発明の第3の観点によるバーコード読取プログラムは、コンピュータを、バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理する手段として機能させるためのバーコード読取プログラムであって、前記手段により、二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とする。   A barcode reading program according to a third aspect of the present invention causes a computer to function as means for binarizing a captured image for each pixel in accordance with the received light intensity of each pixel of an image sensor that has captured the barcode. A barcode reading program, wherein the light receiving intensity of the target pixel for binarization processing is a first light receiving intensity when the whole pixel corresponds to a white portion of the barcode and a second when the whole portion corresponds to a black portion. When taking an intermediate value with respect to the received light intensity, it is determined that the boundary between the white portion and the black portion of the barcode exists in the target pixel, and the increase / decrease relationship of the received light intensity between the target pixel and its adjacent pixels The monochrome order and the boundary position in the target pixel are determined based on the value.

本発明の上記構成により、バーコード読取用のイメージセンサの画素数を増すことなく、最小分解能を向上させることが可能なバーコード読取装置、バーコード読取方法及びバーコード読取プログラムを提供できる。   With the above configuration of the present invention, it is possible to provide a barcode reading apparatus, a barcode reading method, and a barcode reading program capable of improving the minimum resolution without increasing the number of pixels of an image sensor for barcode reading.

本発明の実施形態におけるバーコード読取装置の基本構成を示す斜視構成図である。1 is a perspective configuration diagram illustrating a basic configuration of a barcode reading apparatus according to an embodiment of the present invention. 本発明の実施形態における二値化方法の説明図である。It is explanatory drawing of the binarization method in embodiment of this invention. 本発明の実施形態におけるバーコード読取処理のフロー図である。It is a flowchart of the barcode reading process in the embodiment of the present invention. 本発明の実施形態における二値化処理のフロー図である。It is a flowchart of the binarization process in embodiment of this invention. 本発明の実施形態における二値化処理のフロー図である。It is a flowchart of the binarization process in embodiment of this invention. 本発明の実施形態による二値化方法を適用した例を示す。The example which applied the binarization method by embodiment of this invention is shown. 本発明の実施形態による二値化方法を適用した別の例を示す。Another example to which the binarization method according to the embodiment of the present invention is applied will be described. 本発明の実施形態における読取限界の説明図である。It is explanatory drawing of the reading limit in embodiment of this invention. 本発明の実施形態における読取限界の別の説明図である。It is another explanatory drawing of the reading limit in the embodiment of the present invention. イメージセンサの画素番号に対する受光強度を示すグラフである。It is a graph which shows the light reception intensity with respect to the pixel number of an image sensor. 規格化された受光強度を示すグラフである。It is a graph which shows the standardized received light intensity. 規格化後にノイズ除去を行った受光強度を示すグラフである。It is a graph which shows the light reception intensity | strength which performed noise removal after normalization. 従来技術による二値化方法の説明図であり、誤差が比較的小さい例を示す。It is explanatory drawing of the binarization method by a prior art, and shows the example with a comparatively small error. 従来技術による二値化方法の説明図であり、誤差が大きい例を示す。It is explanatory drawing of the binarization method by a prior art, and shows an example with a big error.

以下、本発明を実施するための形態について詳細に説明する。   Hereinafter, embodiments for carrying out the present invention will be described in detail.

〔バーコード読取装置の構成〕
図1は本発明の実施形態におけるバーコード読取装置の基本構成を示す。バーコード読取装置1は照明光源2と反射ミラー3と集光レンズ4とイメージセンサ5とプロセッサ6とを備える。プロセッサ6は上位装置と通信をするためのラインに接続される。上位装置との通信は無線で行ってもよい。照明光源2はバーコード(又はバーコードラベル)7に光を照射する。反射ミラー3はバーコード7で反射された光を集光レンズ4に向けて反射する。反射ミラー3はバーコード読取装置1の形状によっては省略可能である。集光レンズ4はバーコード7からの反射光をイメージセンサ5上に結像させる。照射光を適切に通す光学フィルタを集光レンズ4と共に設けてもよい。イメージセンサ5はバーコード7を撮像するものであり、バーコード7からの反射光を電気信号に変換する。イメージセンサ5は1次元イメージセンサに限定されず、例えば2次元イメージセンサでもよい。2次元イメージセンサを用いる場合は、適当な1列の画素列を選択的に使用してもよい。プロセッサ6はイメージセンサ5の各画素が示す受光強度からバーコード画像の二値化処理を行う。プロセッサ6は二値化処理で得られた二値化データに対してデコード処理を行ってもよい。デコード処理により、バーコードに符号化されていた原情報が得られる。
[Configuration of bar code reader]
FIG. 1 shows a basic configuration of a barcode reader according to an embodiment of the present invention. The bar code reader 1 includes an illumination light source 2, a reflection mirror 3, a condenser lens 4, an image sensor 5, and a processor 6. The processor 6 is connected to a line for communicating with the host device. Communication with the host device may be performed wirelessly. The illumination light source 2 irradiates the barcode (or barcode label) 7 with light. The reflection mirror 3 reflects the light reflected by the barcode 7 toward the condenser lens 4. The reflection mirror 3 can be omitted depending on the shape of the barcode reader 1. The condenser lens 4 forms an image of the reflected light from the barcode 7 on the image sensor 5. An optical filter that appropriately passes the irradiation light may be provided together with the condenser lens 4. The image sensor 5 images the barcode 7 and converts the reflected light from the barcode 7 into an electrical signal. The image sensor 5 is not limited to a one-dimensional image sensor, and may be a two-dimensional image sensor, for example. When a two-dimensional image sensor is used, an appropriate pixel column may be selectively used. The processor 6 performs binarization processing of the barcode image from the received light intensity indicated by each pixel of the image sensor 5. The processor 6 may perform a decoding process on the binarized data obtained by the binarization process. By the decoding process, the original information encoded in the barcode is obtained.

一般にバーコードは中間色の無い白部と黒部によって構成される。そのため、イメージセンサの一つの画素の受光強度が白と黒の中間の値をとる場合、当該画素にはバーコードの白部と黒部の境界が映り込んでいると想定される。さらに、このような場合に本発明の実施形態では、1画素中における白部と黒部の境界は必ず1箇所であることを前提とする。例えば、図13の例では、イメージセンサ13の画素番号1及び画素番号5の部分がこれに当たる。   In general, a barcode is composed of a white portion and a black portion having no intermediate color. Therefore, when the received light intensity of one pixel of the image sensor takes an intermediate value between white and black, it is assumed that the boundary between the white portion and the black portion of the barcode is reflected in the pixel. Further, in such a case, in the embodiment of the present invention, it is assumed that the boundary between the white part and the black part in one pixel is always one place. For example, in the example of FIG. 13, the pixel numbers 1 and 5 of the image sensor 13 correspond to this.

一画素での受光強度が1(すなわち画素全体が白)又は0(すなわち画素全体が黒)の場合は、画素中に白・黒の境界が存在しない。ここで、受光強度は1画素全体が白のとき1に、1画素全体が黒のとき0になるように規格化されている(以下の説明でも同様)。例えば、受光強度1なら白1、黒0、受光強度0なら、白0、黒1と記録する。尚、この場合、0となる白又は黒の情報は、記録上省いても良い。0となる白又は黒の情報を省かない場合は、後の幅計算上「1となる黒又は白のみで、0となる白・黒部は存在しない(つまり、白・黒の境界が存在しない)」という扱いとする。   When the received light intensity at one pixel is 1 (that is, the entire pixel is white) or 0 (that is, the entire pixel is black), there is no white / black boundary in the pixel. Here, the received light intensity is standardized so that it is 1 when the entire pixel is white and 0 when the entire pixel is black (the same applies to the following description). For example, if the received light intensity is 1, white 1 and black 0 are recorded, and if the received light intensity is 0, white 0 and black 1 are recorded. In this case, white or black information that is 0 may be omitted for recording. If the white or black information that becomes 0 is not omitted, the subsequent width calculation is “only black or white that becomes 1 and there is no white / black portion that becomes 0 (that is, there is no white / black boundary). ”.

ある一つの画素の受光強度が白と黒の中間の値をとる場合、すなわち上記のような規格化がされているとき一画素の受光強度が0より大きくかつ1より小さい場合、「白と黒の中間の値」だけでは、当該画素内における白部と黒部の配置順序(本明細書及び特許請求の範囲では「白黒順序」ともいう)が判断できない。つまり、画素内において同一方向から見て、白部から黒部に変わる境界があるのか、あるいは逆に黒部から白部に変わる境界があるのか判断できない。尚、以下では白部から黒部に変わることを「白→黒」と、黒部から白部に変わることを「黒→白」と略記することもある。   When the received light intensity of one pixel takes an intermediate value between white and black, that is, when the received light intensity of one pixel is larger than 0 and smaller than 1 when the above normalization is performed, “white and black Only the “intermediate value” cannot determine the arrangement order of white portions and black portions in the pixel (also referred to as “monochrome order” in the present specification and claims). That is, it cannot be determined whether there is a boundary that changes from a white part to a black part or a boundary that changes from a black part to a white part when viewed from the same direction in the pixel. Hereinafter, changing from a white part to a black part may be abbreviated as “white → black”, and changing from a black part to a white part may be abbreviated as “black → white”.

本発明の実施形態では一画素の受光強度が白と黒の中間値をとる場合、当該画素中に白と黒の境界が存在すると想定し、当該画素の受光強度を当該画素に隣接する画素の受光強度と比較して、その値が減少しているか、或いは増加しているかによって、当該画素内における白・黒の順番を決定する。以下、当該画素内での白黒順序が白→黒なのか、黒→白なのかを決定する方法を場合分けして説明する。   In the embodiment of the present invention, when the light reception intensity of one pixel takes an intermediate value between white and black, it is assumed that there is a boundary between white and black in the pixel, and the light reception intensity of the pixel is determined based on the pixel adjacent to the pixel. The order of white and black in the pixel is determined depending on whether the value is decreasing or increasing compared to the received light intensity. Hereinafter, a method for determining whether the order of black and white in the pixel is white → black or black → white will be described for each case.

〔ケース(1):バーコードの原像の最小の白幅、黒幅がイメージセンサの画素幅1つ分より広く、かつ、受光強度が白と黒の中間の値をとる状態が2画素以上連続しない場合〕 [Case (1): The minimum white width and black width of the original barcode image is wider than one pixel width of the image sensor, and the light receiving intensity takes an intermediate value between white and black in two or more pixels. (If not continuous)

この場合、白と黒の中間の値の受光強度を有する画素内における白黒順序はシンプルに決定できる。例えば、当該画素の受光強度(大きさは中間値)をその一つ前(すなわち一つ左側又は一つ右側)の画素の受光強度と比較して、その値が減少していれば白→黒の順、増加していれば黒→白の順と判定すればよい。   In this case, the black-and-white order in the pixel having a light reception intensity having a value between white and black can be determined simply. For example, comparing the light reception intensity (size is an intermediate value) of the pixel with the light reception intensity of the previous pixel (that is, one left side or one right side), and if the value decreases, white → black If the number increases, the order of black → white may be determined.

「一つ前の画素」とは、受光強度が中間値の画素についての二値化処理よりも時間的に一つ前に行った二値化処理に係る画素を意味する。例えば、1次元イメージセンサの一連の画素列において一方の端部(左側)の画素からもう一方の端部(右側)の画素に向けて順に白黒順序の判定を含めて二値化処理を行っていく場合を考える。この場合、或る画素の受光強度が中間値を有するとき、その「一つ前の画素」とは、一つ左側の画素のことである。左右は便宜的に仮定したものであり、右側の端部の画素から二値化処理を開始した場合には、「一つ前の画素」とは、一つ右側の画素になることは当然である。いずれにしても、受光強度が中間値を有する画素とそれに隣接している画素とで受光強度を比較して増減状況(増減関係ともいう)を調べて白黒順序を判定する。なお、二値化処理は、イメージセンサの一連の画素列の端部の画素から開始することに限定されるものではなく、画素列中の任意の画素から開始してもよい。 “Previous pixel” means a pixel related to a binarization process that is performed one time before the binarization process for a pixel having a light reception intensity of an intermediate value. For example, in a series of pixel rows of a one-dimensional image sensor, binarization processing including black and white order determination is performed in order from one end (left side) pixel to the other end (right side) pixel. Think about when to go. In this case, when the received light intensity of a certain pixel has an intermediate value, the “previous pixel” is a pixel on the left side. The left and right are assumed for the sake of convenience, and when the binarization process is started from the pixel at the right end, it is natural that the “previous pixel” is the right pixel. is there. In any case, the order of black and white is determined by comparing the received light intensity between the pixel having the intermediate value of the received light intensity and the adjacent pixel to check the increase / decrease state (also referred to as an increase / decrease relationship). Note that the binarization process is not limited to starting from a pixel at the end of a series of pixel columns of the image sensor, and may be started from any pixel in the pixel column.

「一つ前の画素の受光強度と比較して値が減少している」とは、「白と黒の中間の値」をとる画素の一つ前の画素の受光強度が1、つまり、白であることを意味している。「白と黒の中間の値」をとる画素ではその画素中に白から黒に切り替わる境界が映り込んでいると解釈し、その画素は、一つ前の画素から見て白→黒の順番で構成されている、と判断できる。   “The light reception intensity is reduced compared to the light reception intensity of the previous pixel” means that the light reception intensity of the pixel immediately before the pixel taking “an intermediate value between white and black” is 1, that is, white It means that. A pixel that takes a value between “white and black” is interpreted as a boundary that switches from white to black in the pixel, and the pixel is in the order of white to black as seen from the previous pixel. It can be judged that it is configured.

これは、例えば図13(C)の画素番号0,1,2の部分でバーコード原像が白から黒に変化する部分において、画素番号1で白と黒の中間値をとる状態に相当する。図13(C)の画素番号0,1,2の部分の例では、画素番号1に着目すると、その一つ前(一つ左側)の画素、即ち画素番号0の受光強度が1であるため(同図(D))、画素番号1は「一つ前の画素の受光強度と比較して値が減少している」に該当する。このため、前述の考え方で、画素番号1の白・黒の順は白→黒と決定することができる。   This corresponds to, for example, a state in which an intermediate value of white and black is obtained at pixel number 1 in a portion where the barcode original image changes from white to black at the pixel numbers 0, 1, and 2 in FIG. . In the example of the pixel numbers 0, 1, and 2 in FIG. 13C, when attention is paid to the pixel number 1, the light receiving intensity of the previous pixel (one left side), that is, the pixel number 0 is 1. (Drawing (D) in the figure), pixel number 1 corresponds to “the value is reduced compared to the light reception intensity of the previous pixel”. For this reason, in the above-described way of thinking, the order of white / black of the pixel number 1 can be determined as white → black.

次に、「一つ前の画素の受光強度と比較して値が増加している」とは、「白と黒の中間の値」をとる画素の一つ前の画素の受光強度が0、つまり、黒であることを意味している。「白と黒の中間の値」をとる画素ではその画素中に黒から白に切り替わる境界が映り込んでいると解釈し、その画素は、一つ前の画素から見て黒→白の順番で構成されている、と判断できる。   Next, “the value increases compared with the light reception intensity of the previous pixel” means that the light reception intensity of the pixel immediately before the pixel taking “an intermediate value between white and black” is 0, In other words, it means black. A pixel that takes a value between “white and black” is interpreted as a boundary that switches from black to white in the pixel, and the pixel is black → white in the order of the previous pixel. It can be judged that it is configured.

これは、図13(C)の画素番号4,5,6の部分でバーコード原像が黒から白に変化する部分において、画素番号5で白と黒の中間値をとる状態に相当する。図13の画素番号4,5,6の部分の例では、画素番号5に着目すると、その一つ前(一つ左側)の画素、即ち画素番号4の受光強度が0であるため(同図(D))、画素番号5は「一つ前の画素の受光強度と比較して値が増加している」に該当する。このため、前述の考え方で、画素番号5の白・黒の順は黒→白と決定することができる。   This corresponds to a state in which an intermediate value between white and black is obtained at pixel number 5 in a portion where the barcode original image changes from black to white at the pixel numbers 4, 5, and 6 in FIG. In the example of the pixel numbers 4, 5, and 6 in FIG. 13, when attention is focused on the pixel number 5, the light reception intensity of the previous pixel (one left side), that is, the pixel number 4 is 0 (same figure). (D)), the pixel number 5 corresponds to “the value has increased compared to the light reception intensity of the previous pixel”. For this reason, the order of white / black of the pixel number 5 can be determined from black to white based on the above-described concept.

尚、「バーコード原像の最小の白幅、黒幅がイメージセンサ画素幅1つ分より広く、かつ、受光強度が白と黒の中間の値をとる状態が2画素以上連続しない場合」のケース(1)では、文字通り「白と黒の中間の値」をとる画素が2つ以上連続しないため、「白と黒の中間の値」をとる画素において、受光強度の増加または減少のみに着目し、「増減がない」場合は考慮しなくてもよい。「増減がない」場合は処理上、例えば、受光強度が増加又は減少した場合の処理に編入してもよい。   "When the minimum white width and black width of the barcode original image are wider than one image sensor pixel width and the light receiving intensity takes a value intermediate between white and black does not continue for two or more pixels" In the case (1), since two or more pixels that literally take an “intermediate value between white and black” are not consecutive, attention is paid only to the increase or decrease in the received light intensity at the pixel taking the “intermediate value between white and black”. However, it is not necessary to consider the case of “no increase / decrease”. In the case of “no increase / decrease”, for example, the processing may be incorporated into the processing when the received light intensity increases or decreases.

表1にケース(1)での白黒順序の決定方法をまとめる。表1では、現在の位置の画素が白と黒の中間の値の受光強度を有する場合に、その受光強度が一つ前の隣接画素の受光強度に対して増加又は減少しているかにより、現在の画素内における白黒順序が一つ前の画素から見てどのような白・黒パターンになるかを示している。   Table 1 summarizes the method of determining the black and white order in case (1). In Table 1, when the pixel at the current position has a light reception intensity of an intermediate value between white and black, depending on whether the light reception intensity is increased or decreased with respect to the light reception intensity of the previous adjacent pixel, This shows the white / black pattern of the black-and-white order in this pixel when viewed from the previous pixel.

〔ケース(2):バーコード原像の最小の白幅、黒幅がイメージセンサの画素幅1つ分程度より広く、かつ、受光強度が白と黒の中間の値をとる状態が2画素以上連続する場合〕 [Case (2): The minimum white width and black width of the original barcode image is wider than about one pixel width of the image sensor, and the light receiving intensity takes an intermediate value between white and black in two or more pixels. (When consecutive)

この場合、一つ前の画素との受光強度の増減の解析だけでは正しくバーコード原像を再現することができない場合がある。この状態は、例えば図14(C)の画素番号4、5に相当する。   In this case, there is a case where the original barcode image cannot be reproduced correctly only by analyzing the increase / decrease in the received light intensity with the previous pixel. This state corresponds to, for example, pixel numbers 4 and 5 in FIG.

この問題は、一つ前の画素の白・黒順と逆の順番で白・黒の順序を定義することで解決できる。連続二画素の受光強度が中間値の場合における、「一つ前の画素の白・黒順」と現在の位置の画素の白・黒順の関係を表2にまとめる。表2は、一つ前の画素から現在位置の画素に向かう方向における白黒順序を夫々の画素について示している。   This problem can be solved by defining the white / black order in the reverse order of the white / black order of the previous pixel. Table 2 summarizes the relationship between the “white / black order of the previous pixel” and the white / black order of the pixel at the current position when the received light intensity of the continuous two pixels is an intermediate value. Table 2 shows the black-and-white order in the direction from the previous pixel to the pixel at the current position for each pixel.

図14(C)の画素番号3、4、5を例に画素番号5の画素内における白黒順序を決定するプロセスを説明する。   A process for determining the black and white order in the pixel of pixel number 5 will be described by taking pixel numbers 3, 4, and 5 of FIG. 14C as an example.

まず、図14(C)の画素番号3の画素は受光強度1であり、白単色とすることができる。次に、画素番号4の画素は受光強度が0.4であるため、前述の表1の受光強度増減の白・黒順対応表により、白→黒と決定することができる。 First, the pixel of pixel number 3 in FIG. 14C has a light reception intensity of 1, and can be white. Next, since the received light intensity of the pixel of pixel number 4 is 0.4, it can be determined from white to black according to the white / black order correspondence table of the received light intensity increase / decrease in Table 1 described above.

画素番号5の画素は受光強度が0.2である。一つ前の画素(画素番号4)が「白と黒の中間の値をとる状態(受光強度0.4)」であるため、画素番号4と5で、「連続して白と黒の中間の値をとる状態」であるといえる。この時、画素番号4は、「白→黒」という順として決定されているため、画素番号5の白・黒順は画素番号4の白・黒順の逆、つまり、黒→白という順番であると決定することができる。画素番号3〜5について、白・黒順の決定結果は、図14(B)のバーコードの原像の状態と矛盾しない。   The pixel No. 5 has a received light intensity of 0.2. Since the previous pixel (pixel number 4) is “a state that takes an intermediate value between white and black (light reception intensity 0.4)”, in pixel numbers 4 and 5, “an intermediate value between white and black continuously” It can be said that this is a state of taking At this time, since the pixel number 4 is determined in the order of “white → black”, the white / black order of the pixel number 5 is the reverse of the white / black order of the pixel number 4, that is, the order of black → white. It can be determined that there is. For pixel numbers 3 to 5, the white / black order determination result is consistent with the state of the original barcode image in FIG.

尚、前述の「ケース(1):バーコード原像の最小の白幅、黒幅がイメージセンサの画素幅1つ分より広く、かつ、受光強度が白と黒の中間の値をとる状態が2画素以上連続しない場合」では、正しく二値化できる幅が2画素幅程度であるが、ケース(2)では、正しく二値化できる最小幅を1画素幅程度に向上させることができる。   In the above-mentioned “case (1): the minimum white width and black width of the barcode original image is wider than one pixel width of the image sensor, and the received light intensity takes an intermediate value between white and black. In the case where “two or more pixels are not continuous”, the width that can be correctly binarized is about two pixels, but in case (2), the minimum width that can be binarized correctly can be improved to about one pixel.

〔ケース(3):一つ目の画素が白と黒の中間の値をとる場合〕 [Case (3): When the first pixel takes an intermediate value between white and black]

一つ目の画素が白と黒の中間の値をとる場合は、一つ前の画素が存在しないため、上記の白黒決定方法では白→黒、又は黒→白という順番が確定できない。この場合には、一つ目の画素において白→黒と黒→白の両方のパターンがそれぞれ成立していると仮定する。そして、両方の仮定の下で2画素目以降の二値化処理をそれぞれ実施し、二値化の処理継続中または二値化処理完了後に、より適切な結果が得られた方を採用する。   When the first pixel takes an intermediate value between white and black, the previous pixel does not exist, so the order of white → black or black → white cannot be determined by the above-described monochrome determination method. In this case, it is assumed that both white → black and black → white patterns are established in the first pixel. Then, the binarization processing for the second and subsequent pixels is performed under both assumptions, and the method in which a more appropriate result is obtained while the binarization processing is continued or after the binarization processing is completed is adopted.

次に、上記ケース(1)〜(3)に示した白黒順序の決定方法に従ってどのように二値化処理を行うかを具体例に基づいて説明する。   Next, how to perform binarization processing according to the monochrome order determination method shown in the above cases (1) to (3) will be described based on a specific example.

図2はバーコードの原像が図13の原像と同じ場合について本発明の実施形態による二値化処理を行った例を示す。図2(A)のバーコードの原像、図2(B)のイメージセンサ33の画素0〜7及びイメージセンサ上の結像状態、図2(C)の受光強度分布は、図13において対応する図と同一である。   FIG. 2 shows an example in which the binarization process according to the embodiment of the present invention is performed when the original image of the barcode is the same as the original image of FIG. The original image of the barcode in FIG. 2A, the image formation state on the pixels 0 to 7 of the image sensor 33 and the image sensor in FIG. 2B, and the received light intensity distribution in FIG. It is the same as the figure to do.

図2(D)は各画素の受光強度の値(上段)と、各画素とその一つ前の画素とで受光強度を比較して得られた増減状況(下段)とを示している。増減状況は増加なら“+”、減少なら“−”、変化の無いものは“=”、比較対象のないもの(画素番号0)は“*”と記載している。   FIG. 2D shows the value of the light reception intensity of each pixel (upper stage) and the increase / decrease state (lower stage) obtained by comparing the light reception intensity between each pixel and the previous pixel. The increase / decrease status is described as “+” for increase, “−” for decrease, “=” for no change, and “*” for no comparison (pixel number 0).

表3は、図2の例について上述した白黒順序の決定方法を用いて二値化処理した結果をイメージセンサ33の画素番号0〜7についてまとめたものである。   Table 3 summarizes the binarization results for the example of FIG. 2 using the black and white order determination method described above for the pixel numbers 0 to 7 of the image sensor 33.

表3の各画素における二値化処理について説明を加える。
・画素番号0:受光強度が1なので、白1、黒0となる(これは画素幅を1と仮定し、白幅が1で黒幅が0という意味である。以下においても同様。)。受光強度が中間値をとらないため、白1、黒0以外の分岐は考慮しない。
・画素番号1:受光強度が0.6で白黒境界が存在する。2画素目なので、一つ前の画素の受光強度との比較のみで考える。画素番号0と受光強度を比較すると、画素1の受光強度は減少している。よって、白黒境界のパターン(白黒順序)は白→黒と決定し、白0.6、黒0.4となる(すなわち白幅0.6、黒幅0.4)。すなわち、バーコードの白部と黒部の境界は画素番号1の画素内において画素番号0側の端部から0.6の位置に存在する。よって「白黒順序」と「境界位置」が確定した。
・画素番号2、3,4:受光強度が0なので、それぞれ白0、黒1となる。
・画素番号5:受光強度が0.2で白黒境界が存在する。一つ前の画素(画素番号4)と現在の画素の受光強度を比較すると増加している。よって、白黒境界のパターンは黒→白の順と決定し、黒0.8、白0.2となる。
・画素番号6,7:受光強度が1なので、それぞれ白1、黒0となる。
The binarization process in each pixel in Table 3 will be described.
Pixel number 0: Since the received light intensity is 1, white 1 and black 0 (this means that the pixel width is 1, the white width is 1 and the black width is 0. The same applies hereinafter). Since the received light intensity does not take an intermediate value, branches other than white 1 and black 0 are not considered.
Pixel number 1: received light intensity is 0.6 and a black and white border exists. Since this is the second pixel, only the comparison with the received light intensity of the previous pixel is considered. When the pixel number 0 is compared with the received light intensity, the received light intensity of the pixel 1 is decreased. Therefore, the black-and-white border pattern (black-and-white order) is determined as white → black and becomes white 0.6 and black 0.4 (that is, white width 0.6 and black width 0.4). That is, the boundary between the white portion and the black portion of the barcode exists at a position of 0.6 from the end on the pixel number 0 side in the pixel of pixel number 1. Therefore, the “black and white order” and the “boundary position” are fixed.
Pixel numbers 2, 3, and 4: Since the received light intensity is 0, white 0 and black 1 respectively.
Pixel number 5: received light intensity is 0.2 and a black and white boundary exists. When the received light intensity of the previous pixel (pixel number 4) and the current pixel are compared, it increases. Therefore, the black-and-white boundary pattern is determined in the order of black → white, and becomes black 0.8 and white 0.2.
Pixel numbers 6 and 7: Since the received light intensity is 1, white 1 and black 0 respectively.

この結果、黒部に着目すると、画素1〜5にかけて黒部が連続していてその幅は、画素1〜5の黒部の値の合計、つまり、0.4+1.0+1.0+1.0+0.8=4.2とすることができる。この結果は、バーコードの原像32の黒部の幅と一致する。図2(E)に、この方法によって得られた二値化後のパターン37を示す。この二値化後のパターン37と、従来技術による方法で得られる二値化後のパターン(図13(E)のパターン17)を比較すると、本発明の実施形態の二値化方法によって得られる二値化後のパターンの方がより原像に近くなる(本例では一致)ことが明らかである。   As a result, paying attention to the black portion, the black portion is continuous from pixel 1 to pixel 5 and the width thereof is the sum of the black portion values of pixels 1 to 5, that is, 0.4 + 1.0 + 1.0 + 1.0 + 0.8 = 4.2. Can do. This result coincides with the width of the black portion of the barcode original image 32. FIG. 2E shows a binarized pattern 37 obtained by this method. When this binarized pattern 37 is compared with the binarized pattern obtained by the method according to the prior art (pattern 17 in FIG. 13E), it is obtained by the binarization method of the embodiment of the present invention. It is clear that the pattern after binarization is closer to the original image (in this example, it matches).

次に、本発明の実施形態におけるバーコード読取の処理フローを具体例を挙げて説明する。   Next, the barcode reading process flow in the embodiment of the present invention will be described with a specific example.

〔ハードウェア構成と全体の処理フロー〕
例として図1のバーコード読取装置のハードウェア構成を考える。このバーコード読取装置は図3のバーコード読取処理フローを実行できる構成を実装しているものとする。バーコード7の原像は反射ミラー3と集光レンズ4を通してイメージセンサ5に映し出される。図3のフローでは、イメージセンサ5に結像した状態(S2)からセンサ受光強度出力を取得し(S3)、その値から二値化(S4)する。二値化された情報をデコード処理(S5)してデコードに成功すれば(S6のyes)、デコードデータを出力(S7)して処理を終了し(S8)、デコードに失敗すれば(S6のno)、デコード出力をせずに終了する(S8)。
[Hardware configuration and overall processing flow]
As an example, consider the hardware configuration of the barcode reader of FIG. This barcode reader is assumed to have a configuration capable of executing the barcode reading process flow of FIG. The original image of the barcode 7 is projected on the image sensor 5 through the reflecting mirror 3 and the condenser lens 4. In the flow of FIG. 3, the sensor light reception intensity output is acquired from the state imaged on the image sensor 5 (S2) (S3), and binarized from the value (S4). If the binarized information is decoded (S5) and decoding is successful (yes in S6), the decoded data is output (S7) and the processing is terminated (S8), and if decoding fails (S6) no), the process ends without decoding (S8).

本発明の実施形態による二値化方法は、図3のステップS4の二値化処理に相当する部分に適用される。図3のフローの二値化処理(S4)の詳細フローを示したものが図4と図5である。図4、図5のフローは、本発明の実施形態(表1、表2を含む)に基づくフローである。   The binarization method according to the embodiment of the present invention is applied to a portion corresponding to the binarization process in step S4 of FIG. FIG. 4 and FIG. 5 show the detailed flow of the binarization process (S4) of the flow of FIG. 4 and 5 are flows based on the embodiment of the present invention (including Tables 1 and 2).

〔二値化処理の具体例1〕
以下、図14に示すバーコード原像に対して本発明の実施形態による二値化処理を適用する場合を例にとって説明する。このバーコード原像は、白部の幅1.4で黒部の幅1.4の白黒パターンで構成されている。イメージセンサの各画素の幅は1.0である。
[Specific example 1 of binarization processing]
Hereinafter, a case where the binarization processing according to the embodiment of the present invention is applied to the barcode original image shown in FIG. 14 will be described as an example. This barcode original image is composed of a monochrome pattern having a white portion width of 1.4 and a black portion width of 1.4. The width of each pixel of the image sensor is 1.0.

図14(D)に示すように、イメージセンサの各画素の受光強度を閾値0.5によって二値化する従来技術の場合、バーコード原像22に対して二値化後のパターン27が大きく異なる結果となることは、前述の通りである。   As shown in FIG. 14D, in the case of the conventional technique in which the received light intensity of each pixel of the image sensor is binarized by a threshold value 0.5, the binarized pattern 27 differs greatly from the barcode original image 22. As described above.

図6は、図14と同じバーコード原像に対して本発明の実施形態による方法を用いて二値化する場合を示す。図6(A)はバーコードの原像42を示す。図6(B)はイメージセンサにおける画素番号0〜7までの8個の画素43を示し、イメージセンサ上の結像状態も示している。図6(C)は各画素の受光強度図である。図6(D)は、各画素の受光強度の値(上段)と、各画素とその左隣の画素とで受光強度を比較して得られた増減状況(下段)とを示している。増減状況は増加なら“+”、減少なら“−”、比較対象のない先頭画素(画素番号0)は“*”と記載している。   FIG. 6 shows a case where the same barcode original image as FIG. 14 is binarized using the method according to the embodiment of the present invention. FIG. 6A shows an original image 42 of the barcode. FIG. 6B shows eight pixels 43 having pixel numbers 0 to 7 in the image sensor, and also shows an image formation state on the image sensor. FIG. 6C is a light reception intensity diagram of each pixel. FIG. 6D shows the value of the light reception intensity of each pixel (upper stage) and the increase / decrease state (lower stage) obtained by comparing the light reception intensity between each pixel and the pixel adjacent to the left. The increase / decrease status is described as “+” for increase, “−” for decrease, and “*” for the first pixel (pixel number 0) not to be compared.

図4は本発明の実施形態における二値化処理(図3のステップS4)の詳細フローを示す。二値化処理を開始すると(S10)、まず最初に1番目の画素(=画素番号0)の受光強度を取得する(S11)。図6の例では、イメージセンサの1番目の画素の受光強度は0.8となる。次に、取得した受光強度が0又は1かを判断する(S12)。図6の例では、取得した受光強度は0.8なので、“no”に分岐し、ステップS13に進む。   FIG. 4 shows a detailed flow of the binarization process (step S4 in FIG. 3) in the embodiment of the present invention. When the binarization process is started (S10), first, the received light intensity of the first pixel (= pixel number 0) is acquired (S11). In the example of FIG. 6, the received light intensity of the first pixel of the image sensor is 0.8. Next, it is determined whether the received light intensity is 0 or 1 (S12). In the example of FIG. 6, since the acquired received light intensity is 0.8, the process branches to “no” and proceeds to step S13.

ステップ13では、1画素目(=画素番号0)の受光強度から白・黒の順番は確定できないため、幅情報群Aと幅情報群Bを設けると共に、それぞれにペンディング値(P)を設定する。幅情報群Aは、1番目の画素における白黒順序が白→黒であると仮定して後続画素から順次得られるバーコードの白部幅と黒部幅に関するデータ群である(図6(E)参照)。幅情報群Bは、1番目の画素における白黒順序が黒→白であると仮定して後続画素から順次得られるバーコードの白黒パターンと白部幅及び黒部幅とに関するデータ群である(図6(F)参照)。ペンディング値(P)は上記の仮定から出発して二値化処理を行って得られた結果(二値化データ)の信頼性の程度を示す値であり、値が小さいほど信頼性が高い。なお、幅情報群は「二値化データ群」ともいう。   In step 13, since the order of white and black cannot be determined from the received light intensity of the first pixel (= pixel number 0), a width information group A and a width information group B are provided, and a pending value (P) is set for each. . The width information group A is a data group related to the white part width and black part width of the barcode sequentially obtained from the subsequent pixels on the assumption that the black and white order in the first pixel is white → black (see FIG. 6E). ). The width information group B is a data group relating to the black-and-white pattern of the bar code, the white portion width, and the black portion width, which are sequentially obtained from the subsequent pixels on the assumption that the black and white order in the first pixel is black → white (FIG. 6). (See (F)). The pending value (P) is a value indicating the degree of reliability of the result (binarized data) obtained by performing the binarization process starting from the above assumption, and the smaller the value, the higher the reliability. The width information group is also referred to as a “binarized data group”.

ステップS12において受光強度が0又は1の場合は、1つの幅情報群を設けることになり、受光強度と白黒の別を示す情報を記録する(S14)。   When the received light intensity is 0 or 1 in step S12, one width information group is provided, and information indicating whether the received light intensity is different from black and white is recorded (S14).

図6の例では、ステップS14において、幅情報群Aにはペンディング値(PA)=0、画素番号0の幅情報として、データ番号00に白:0.8、データ番号01に黒:0.2と記録し、また、幅情報群Bにはペンディング値(PB)=0、画素番号0の幅情報として、データ番号00に黒:0.2、データ番号01に白:0.8とそれぞれ記録する。図6(E)と図6(F)はこのときの二値化をイメージ化したものであり、幅情報群Aを符号46で、幅情報群Bを符号47で示している。ステップS14の段階では、それぞれ画素0の部分のみが記録された状態である。 In the example of FIG. 6, in step S14, the width information group A is recorded with pending value (P A ) = 0, width information of pixel number 0 as white: 0.8 for data number 00 and black: 0.2 for data number 01. Further, in the width information group B, the pending value (P B ) = 0, the width information of the pixel number 0 is recorded as black: 0.2 in the data number 00 and white: 0.8 in the data number 01, respectively. FIGS. 6E and 6F are images of the binarization at this time. The width information group A is indicated by reference numeral 46 and the width information group B is indicated by reference numeral 47. In step S14, only the pixel 0 portion is recorded.

次に、図4のステップS15に移り、2画素目(=画素1)の受光強度、即ち、図6(B)のイメージセンサ43の画素番号1の画素の受光強度を取得する。このとき取得される受光強度は0.6となる。ステップS16では、取得した受光強度が0か1かを判断する。図6の例では、取得した受光強度は0.6であるため、“no”のフローに進み、図5のステップS21に移る。   Next, the process proceeds to step S15 in FIG. 4, and the received light intensity of the second pixel (= pixel 1), that is, the received light intensity of the pixel of pixel number 1 of the image sensor 43 in FIG. 6B is acquired. The received light intensity obtained at this time is 0.6. In step S16, it is determined whether the acquired received light intensity is 0 or 1. In the example of FIG. 6, since the acquired received light intensity is 0.6, the process proceeds to the “no” flow and proceeds to step S21 of FIG.

図5のステップS21は「有効な幅情報群の一つを選ぶ(計算済みを除く)」処理だが、幅情報群A、幅情報群Bともに未計算なので、まずは幅情報群Aを選び、次のステップS22に進む。ステップS22では一つ前の画素、即ち画素番号0の受光強度が、1か0であったかどうかを確認する。図6の例では、一つ前の画素、即ち画素番号0の受光強度は0.8であるため、ステップ22の“no”のフローに進み、ステップS24に移る。ここまでのステップによって、画素番号0と画素番号1は「受光強度が白と黒の中間の値をとる状態」であることを示している。   Step S21 in FIG. 5 is a process of “selecting one effective width information group (excluding calculated)”, but since both the width information group A and the width information group B are not calculated, the width information group A is selected first. The process proceeds to step S22. In step S22, it is confirmed whether the light reception intensity of the previous pixel, that is, pixel number 0, is 1 or 0. In the example of FIG. 6, since the received light intensity of the previous pixel, that is, pixel number 0 is 0.8, the process proceeds to the “no” flow in step 22 and proceeds to step S24. By the steps so far, the pixel number 0 and the pixel number 1 indicate that “the received light intensity is an intermediate value between white and black”.

ステップS24では、一つ前の画素、即ち画素番号0の白・黒の順の決定結果が「黒→白」であるかどうかを確認する。幅情報群Aの画素番号0は白→黒の順であるため、このフローでは”no”となり、ステップS25に進む。ステップS25で、現在処理している画素、即ち画素番号1の白・黒順を「黒→白」と決定し、ステップS27に進む。   In step S24, it is confirmed whether or not the determination result of the previous pixel, that is, pixel number 0 in the order of white and black is “black → white”. Since the pixel number 0 of the width information group A is in the order of white → black, “no” is obtained in this flow, and the process proceeds to step S25. In step S25, the white / black order of the pixel currently processed, that is, pixel number 1, is determined as “black → white”, and the process proceeds to step S27.

ステップS27では、現在処理中の画素番号1の画素において「黒→白」という順に(1−受光強度値)の幅の黒部と、受光強度値の幅の白部とが配置されているとし、一つ前の画素との境界を挟む部分、即ち画素番号0と画素番号1の境界をまたぐ黒部の幅の合計を計算する。図6の例では、画素番号0の黒部の幅は0.2、画素番号1の黒部の幅が0.4であるため、合計すると0.6、つまり「黒の連続した幅情報の合計は0.6」となる。次にステップS29に進む。   In step S27, it is assumed that a black portion having a width of (1−received light intensity value) and a white portion having a width of the received light intensity value are arranged in the order of “black → white” in the pixel of pixel number 1 being currently processed. The sum of the widths of the black portions that straddle the boundary between the previous pixel, that is, the boundary between pixel number 0 and pixel number 1, is calculated. In the example of FIG. 6, since the width of the black portion of pixel number 0 is 0.2 and the width of the black portion of pixel number 1 is 0.4, the total is 0.6, that is, “the total of continuous width information of black is 0.6”. Next, the process proceeds to step S29.

ステップS29では、この計算結果が1以上かどうかを確認する。本例では結果は1以上ではないため、“no”となり、ステップS32に進む。   In step S29, it is confirmed whether the calculation result is 1 or more. In this example, since the result is not 1 or more, the result is “no”, and the process proceeds to step S32.

ステップS32では、他に有効な幅情報群があるかどうかを確認する。この時、幅情報群Aの処理のみ行われているが、幅情報群Bは存在するため、「ほかに有効な幅情報群がある」となり、“yes”に分岐してステップS33に進む。   In step S32, it is confirmed whether there is another effective width information group. At this time, only the processing of the width information group A is performed. However, since the width information group B exists, “there is another effective width information group”, the process branches to “yes” and proceeds to step S33.

ステップS33では、直前まで計算していた幅情報群、即ち、幅情報群Aを不適切だったとして無効化し、再びステップ21に戻る。   In step S33, the width information group calculated immediately before, that is, the width information group A is invalidated as inappropriate, and the process returns to step 21 again.

尚、ステップS32における判断で、隣接画素との境界を跨いでいる部分の幅が1未満の範囲(「破棄範囲」ともいう)にあり、他に有効な情報群が存在しなかった場合、ステップS35に進む。ステップS35では、隣接画素との境界を跨いでいる部分の幅が1未満であっても有効なものとして取り扱い、白・黒の幅情報を記録するが、同時に、ペンディング値(P)を1インクリメントして、データの信憑性レベルが低下していることを記録する。   If it is determined in step S32 that the width of the portion straddling the boundary with the adjacent pixel is in a range less than 1 (also referred to as “discard range”), and no other valid information group exists, step Proceed to S35. In step S35, even if the width of the portion straddling the boundary with the adjacent pixel is less than 1, it is treated as valid and white / black width information is recorded, but at the same time, the pending value (P) is incremented by 1. And record that the credibility level of the data is decreasing.

ステップS33からステップS21に戻ると、ステップS21で再び幅情報群を選ぶ。ここでは未計算の幅情報群Bを選ぶことになる。ステップS22では、1つ前の画素(画素番号0)で取得した受光強度は0.8であり、0でも1でもないので、“no”に分岐してステップS24に進む。   When returning from step S33 to step S21, the width information group is selected again in step S21. Here, the uncalculated width information group B is selected. In step S22, the received light intensity acquired in the previous pixel (pixel number 0) is 0.8 and is neither 0 nor 1. Therefore, the process branches to “no” and proceeds to step S24.

ステップS24では、一つ前の画素、即ち、幅情報群Bの画素番号0は黒→白の順であるため、このフローでは“yes”となり、ステップS26に進む。ステップS26で、現在処理している画素、即ち画素番号1の白・黒順を「白→黒」と決定し、ステップS28に進む。   In step S24, since the previous pixel, that is, pixel number 0 of the width information group B is in the order of black → white, “yes” in this flow, the process proceeds to step S26. In step S26, the white / black order of the pixel currently processed, that is, pixel number 1, is determined as “white → black”, and the process proceeds to step S28.

ステップS28では、現在処理中の画素番号1の画素において「白→黒」という順に受光強度値の幅の白部と、(1−受光強度値)の幅の黒部とが配置されているとし、一つ前の画素との境界を挟む部分、即ち画素番号0と画素番号1の境界をまたぐ白部の幅の合計を計算する。図6の例では、画素番号0の白部の幅は0.8、画素番号1の白部の幅が0.6であるため、合計すると1.4、つまり「白の連続した幅情報の合計は1.4」となる(これを図にしたものが図6(F)の符号47で示した部分である)。次にステップS30に進む。   In step S28, it is assumed that a white portion having a width of the received light intensity value and a black portion having a width of (1−received light intensity value) are arranged in the order of “white → black” in the pixel of pixel number 1 being currently processed. The sum of the widths of the white portions that straddle the boundary between the pixel number 0 and the pixel number 1 is calculated. In the example of FIG. 6, the width of the white portion of pixel number 0 is 0.8 and the width of the white portion of pixel number 1 is 0.6, so the total is 1.4, that is, “the total of white continuous width information is 1.4”. (This is illustrated in FIG. 6F as indicated by reference numeral 47 in FIG. 6). Next, the process proceeds to step S30.

ステップS30では、この計算結果が1以上かどうかを確認する。結果は1以上のため、“yes”となり、ステップS31に進む。ステップS31では、幅情報群Bの画素番号1の幅情報として白→黒の順に、データ番号02に白:0.6、データ番号03に黒:0.4と記録し、次のステップS34に進む。ステップS34では他に処理すべき有効な幅情報群があるかどうか確認する。本例ではこの段階で有効な情報群が情報群Bのみなので、“no”に進み、図4のステップS18に移る。   In step S30, it is confirmed whether the calculation result is 1 or more. Since the result is 1 or more, the answer is “yes” and the process proceeds to step S31. In step S31, white: 0.6 is recorded in data number 02 and black: 0.4 in data number 03 in the order of white → black as the width information of pixel number 1 in width information group B, and the process proceeds to the next step S34. In step S34, it is confirmed whether there is another effective width information group to be processed. In this example, since the information group effective at this stage is only the information group B, the process proceeds to “no” and proceeds to step S18 in FIG.

ステップS18では、最後に取得した受光強度の画素がイメージセンサの最後の画素かどうかを確認する。この段階ではまだ次の画素が存在するため、“no”に進み、ステップS15に移る。   In step S18, it is confirmed whether or not the last received light intensity pixel is the last pixel of the image sensor. At this stage, since the next pixel still exists, the process proceeds to “no” and proceeds to step S15.

ステップS15では、次の画素、つまり3つ目である画素番号2の受光強度を取得する。図6の例では、受光強度は“0”となる。ステップS16では、受光強度が0か1かを判断し、本例では受光強度が0のため、“yes”に進み、ステップS17に移る。   In step S15, the received light intensity of the next pixel, that is, the third pixel number 2, is acquired. In the example of FIG. 6, the received light intensity is “0”. In step S16, it is determined whether the received light intensity is 0 or 1. In this example, since the received light intensity is 0, the process proceeds to “yes”, and the process proceeds to step S17.

ステップS17では、画素番号2の受光強度の結果として、データ番号04に黒:1、データ番号05に白:0として記録する。次のステップS18に移り、最後に取得した受光強度の画素が最後の画素かどうかを確認し、ステップS15に戻るか次に進むか判断する。   In step S17, as a result of the received light intensity of the pixel number 2, the data number 04 is recorded as black: 1 and the data number 05 is recorded as white: 0. The process proceeds to the next step S18, where it is confirmed whether or not the last pixel of received light intensity is the last pixel, and it is determined whether the process returns to step S15 or proceeds to the next.

このような処理を画素番号7(イメージセンサの最後の画素)まで行い、ステップS18の判断で最終画素と判断した場合、ステップS19に移る。このとき、有効な幅情報群が複数ある場合は、最もペンディング値が小さいものを結果として選ぶ。本例では、幅情報群Bのみが有効となっているため、幅情報群Bが結果として選ばれることになる。次のステップS20で、選択した幅情報群のデータを整理して、デコードで使用できるデータ(二値化データ)にする、即ち二値化である。   Such processing is performed up to pixel number 7 (the last pixel of the image sensor), and if it is determined in step S18 that the pixel is the last pixel, the process proceeds to step S19. At this time, when there are a plurality of effective width information groups, the one having the smallest pending value is selected as a result. In this example, since only the width information group B is valid, the width information group B is selected as a result. In the next step S20, the data of the selected width information group is organized into data that can be used for decoding (binarized data), that is, binarization.

ステップS20の処理が終了したら、図3のデコード処理(S5)に進み、二値化処理で得られた二値化データをデコードする。次のステップS6でデコードが成功したか否かを判断し、デコードに成功したならば(S6で“yes”)、デコードデータを出力(S7)して終了し(S8)、デコードに成功しなければ(S6で“no”)、そのまま終了する(S8)。   When the process of step S20 is completed, the process proceeds to the decoding process (S5) of FIG. 3, and the binarized data obtained by the binarizing process is decoded. In the next step S6, it is determined whether or not the decoding is successful. If the decoding is successful (“yes” in S6), the decoding data is output (S7) and terminated (S8), and the decoding must be successful. If it is “no” in S6, the process is terminated as it is (S8).

本例で計算した幅情報群A、幅情報群Bの具体的なデータと幅情報群Bの二値化データ(幅データを整理したもの)を表4にまとめる。   Table 4 summarizes specific data of the width information group A and width information group B and binarized data of the width information group B (arranged width data) calculated in this example.

結果として、バーコード原像42に対する二値化処理により得られた二値化データは、図6(F)に示すバーコード像47となり、バーコード原像42と一致した二値化結果を得ることができた。従来の方法で二値化した結果である図14(E)のパターン27(=図6(G)のパターン48)と比較すると、本発明の実施形態による二値化処理によって再現したバーコード像の方がより正確である。   As a result, the binarized data obtained by the binarization processing on the barcode original image 42 becomes the barcode image 47 shown in FIG. 6F, and a binarization result that matches the barcode original image 42 is obtained. I was able to. Compared with the pattern 27 in FIG. 14E (= the pattern 48 in FIG. 6G) which is the result of binarization by the conventional method, the barcode image reproduced by the binarization processing according to the embodiment of the present invention. Is more accurate.

〔二値化処理の具体例2〕
次に、図7に示すバーコード原像52に対して本発明の実施形態による二値化処理を適用する場合を例にとって説明する。このバーコード原像52は、白部の幅0.8で黒部の幅0.8の白黒パターンで構成されている。イメージセンサの各画素の幅は1.0である。すなわち、イメージセンサに映るバーコード原像の白・黒の各幅がイメージセンサの各画素幅より狭い状態である。図7(G)は、閾値0.5による従来の二値化方法で二値化した場合の結果を示す。バーコード原像52の白・黒のパターンと比較すると、バーコード原像52には同じ幅の「黒」が5本存在するが、二値化後のパターン58では黒は3本しか存在しないだけでなく、幅が異なる状態となり、適切に二値化できないといえる。
[Specific example 2 of binarization processing]
Next, a case where the binarization processing according to the embodiment of the present invention is applied to the barcode original image 52 shown in FIG. 7 will be described as an example. The barcode original image 52 is composed of a black and white pattern having a white width of 0.8 and a black width of 0.8. The width of each pixel of the image sensor is 1.0. That is, the white and black widths of the barcode original image reflected on the image sensor are narrower than the pixel widths of the image sensor. FIG. 7G shows a result when binarization is performed by a conventional binarization method with a threshold value of 0.5. Compared to the white / black pattern of the barcode original image 52, the barcode original image 52 has five “black” s having the same width, but the binarized pattern 58 has only three blacks. In addition, it can be said that the width becomes different and cannot be appropriately binarized.

一方、上記の具体例1と同様に、本発明の実施形態の図3、図4、図5のフローに従って二値化処理を行うとどうなるか、以下に示す。   On the other hand, as in the first specific example, what happens when the binarization processing is performed according to the flow of FIGS. 3, 4, and 5 of the embodiment of the present invention is shown below.

図7(A)はバーコード原像52を示す。図7(B)はイメージセンサにおける画素番号0〜7までの8個の画素53を示す、イメージセンサ上の結像状態も示している。図7(C)は各画素の受光強度図である。図7(D)は、各画素の受光強度の値(上段)と、各画素とその左隣の画素とで受光強度を比較して得られた増減状況(下段)とを示している。増減状況は増加なら“+”、減少なら“−”、等しければ“=”を記し、比較対象のない先頭画素(画素番号0)は“*”を記している。   FIG. 7A shows a barcode original image 52. FIG. 7B also shows an image formation state on the image sensor showing eight pixels 53 of pixel numbers 0 to 7 in the image sensor. FIG. 7C is a light reception intensity diagram of each pixel. FIG. 7D shows the value of the light reception intensity of each pixel (upper stage) and the increase / decrease state (lower stage) obtained by comparing the light reception intensity between each pixel and the pixel adjacent to the left. The increase / decrease status is “+” for increase, “−” for decrease, “=” for equality, and “*” for the first pixel (pixel number 0) not to be compared.

図3のフローにおいてバーコード読取装置のイメージセンサに映し出された映像を二値化するステップ(S4)まで来ると、図4の二値化処理開始のステップ(S10)に移る。次に最初の1画素目(=画素番号0)の受光強度を取得する(S11)。図7の例では、イメージセンサの1画素目(=画素番号0)の受光強度は0.2である。次に、取得した受光強度が0又は1かを判断する(S12)。図7の例では、取得した受光強度は0.2なので、“no”に分岐し、ステップS13に進む。   In the flow of FIG. 3, when it comes to the step (S4) of binarizing the image projected on the image sensor of the barcode reader, the process proceeds to the step (S10) of binarization processing start of FIG. Next, the received light intensity of the first pixel (= pixel number 0) is acquired (S11). In the example of FIG. 7, the received light intensity of the first pixel (= pixel number 0) of the image sensor is 0.2. Next, it is determined whether the received light intensity is 0 or 1 (S12). In the example of FIG. 7, since the acquired light reception intensity is 0.2, the process branches to “no” and proceeds to step S13.

ステップ13では、この段階で1画素目(=画素番号0)の白・黒の順番は確定できないため、幅情報群Aと幅情報群Bを設けると共に、それぞれにペンディング値(P)を設定する。幅情報群Aは、1番目の画素における白黒順序が白→黒であると仮定して後続画素から順次得られるバーコードの白部幅と黒部幅に関するデータ群である(図7(E)参照)。幅情報群Bは、1番目の画素における白黒順序が黒→白であると仮定して後続画素から順次得られるバーコードの白黒パターンと白部幅及び黒部幅とに関するデータ群である(図7(F)参照)。   In step 13, since the order of white / black of the first pixel (= pixel number 0) cannot be determined at this stage, a width information group A and a width information group B are provided, and a pending value (P) is set for each. . The width information group A is a data group related to the white portion width and black portion width of the barcode sequentially obtained from the subsequent pixels on the assumption that the black and white order in the first pixel is white → black (see FIG. 7E). ). The width information group B is a data group relating to the black-and-white pattern of the barcode, the white portion width, and the black portion width, which are sequentially obtained from the subsequent pixels on the assumption that the black and white order in the first pixel is black → white (FIG. 7). (See (F)).

図7の例では、ステップS14において、幅情報群Aにはペンディング値(PA)=0、画素番号0の幅情報として、データ番号00に白:0.2、データ番号01に黒:0.8を記録し、また、幅情報群Bにはペンディング値(PB)=0、画素番号0の幅情報としてデータ番号00に黒:0.2、データ番号01に白:0.2とそれぞれ記録する。図7(E)と図7(F)ははこのときの二値化をイメージ化したものであり、幅情報群Aを符号56で、幅情報群Bを符号57で示している。ステップS14の段階では、それぞれ画素0の部分のみが記録された状態である。 In the example of FIG. 7, in step S14, the width information group A is recorded with pending value (P A ) = 0, pixel number 0 as white information: data number 00: white: 0.2, data number 01: black: 0.8 In the width information group B, the pending value (P B ) = 0, the width information of pixel number 0 is recorded as black: 0.2 in data number 00, and white: 0.2 in data number 01. FIG. 7E and FIG. 7F are images of the binarization at this time. The width information group A is indicated by reference numeral 56 and the width information group B is indicated by reference numeral 57. In step S14, only the pixel 0 portion is recorded.

次に、図4のステップS15に移り、2画素目(=画素1)の受光強度、即ち、図7(B)のイメージセンサ53の画素番号1の画素の受光強度を取得する。このとき取得される受光強度は0.6となる。ステップS16では、取得した受光強度が0か1かを判断する。図7の例では、取得した受光強度は0.6のため、“no”のフローに進み、図5のステップS21に移る。   Next, the process proceeds to step S15 in FIG. 4, and the received light intensity of the second pixel (= pixel 1), that is, the received light intensity of the pixel of pixel number 1 of the image sensor 53 in FIG. 7B is acquired. The received light intensity obtained at this time is 0.6. In step S16, it is determined whether the acquired received light intensity is 0 or 1. In the example of FIG. 7, since the acquired received light intensity is 0.6, the process proceeds to a “no” flow and proceeds to step S21 of FIG.

図5のステップS21は「有効な幅情報群の一つを選ぶ(計算済みを除く)」処理だが、幅情報群A、幅情報群Bともに未計算なので、まずは幅情報群Aを選び、次のステップS22に進む。ステップS22では一つ前の画素、即ち画素番号0の受光強度が、1か0であったかどうかを確認する。図7の例では、一つ前の画素、即ち画素番号0の受光強度は0.2であるため、ステップ22の“no”のフローに進み、ステップS24に移る。ここまでのステップによって、画素番号0と画素番号1は「受光強度が白と黒の中間の値をとる状態」であることを示している。   Step S21 in FIG. 5 is a process of “selecting one effective width information group (excluding calculated)”, but since both the width information group A and the width information group B are not calculated, the width information group A is selected first. The process proceeds to step S22. In step S22, it is confirmed whether the light reception intensity of the previous pixel, that is, pixel number 0, is 1 or 0. In the example of FIG. 7, since the received light intensity of the previous pixel, that is, pixel number 0 is 0.2, the process proceeds to the “no” flow of step 22 and proceeds to step S24. By the steps so far, the pixel number 0 and the pixel number 1 indicate that “the received light intensity is an intermediate value between white and black”.

ステップS24では、一つ前の画素、即ち画素番号0の白・黒の順の決定結果が「黒→白」であるかどうかを確認する。幅情報群Aの画素番号0は白→黒の順であるため、このフローでは“no”となり、ステップS25に進む。ステップS25で、現在処理している画素、即ち画素番号1の白・黒順を「黒→白」と決定し、ステップS27に進む。   In step S24, it is confirmed whether or not the determination result of the previous pixel, that is, pixel number 0 in the order of white and black is “black → white”. Since the pixel number 0 of the width information group A is in the order of white → black, “no” is obtained in this flow, and the process proceeds to step S25. In step S25, the white / black order of the pixel currently processed, that is, pixel number 1, is determined as “black → white”, and the process proceeds to step S27.

ステップS27では、現在処理中の画素番号1の画素において「黒→白」という順に(1−受光強度値)の幅の黒部と、受光強度値の幅の白部とが配置されているとし、一つ前の画素との境界を挟む部分、即ち画素番号0と画素番号1の境界をまたぐ黒部の幅の合計を計算する。図7の例では、画素番号0の黒部の幅は0.8、画素番号1の黒部の幅が0.4であるため、合計すると1.2、つまり「黒の連続した幅情報の合計は1.2」となる。次にステップS29に進む。   In step S27, it is assumed that a black portion having a width of (1−received light intensity value) and a white portion having a width of the received light intensity value are arranged in the order of “black → white” in the pixel of pixel number 1 being currently processed. The sum of the widths of the black portions that straddle the boundary between the previous pixel, that is, the boundary between pixel number 0 and pixel number 1, is calculated. In the example of FIG. 7, the width of the black portion of pixel number 0 is 0.8 and the width of the black portion of pixel number 1 is 0.4, so the total is 1.2, that is, “the total of continuous black width information is 1.2”. Next, the process proceeds to step S29.

ステップS29では、この計算結果が1以上かどうかを確認する。本例では結果は1以上なので、“yes”となり、ステップS31に進む。ステップS31では、幅情報群Aの画素番号1の幅情報として白→黒の順に、データ番号02に白:0.2、データ番号03に黒:0.8と記録し、次のステップS34に進む。ステップS34では他に処理すべき有効な幅情報群があるかどうか確認する。本例ではこの段階で幅情報群Bが未計算なので、“yes”に進み、ステップS21に戻る。   In step S29, it is confirmed whether the calculation result is 1 or more. In this example, since the result is 1 or more, “yes” is determined, and the process proceeds to step S31. In step S31, the width information of pixel number 1 of the width information group A is recorded in the order of white → black as white: 0.2 and data number 03 as black: 0.8, and the process proceeds to the next step S34. In step S34, it is confirmed whether there is another effective width information group to be processed. In this example, since the width information group B is not calculated at this stage, the process proceeds to “yes” and returns to step S21.

ステップS21では、再び幅情報群を選ぶ。ここでは未計算の幅情報群Bを選ぶことになる。ステップS22では、1つ前の画素(画素番号0)で取得した受光強度は0.2であり、0でも1でもないので、“no”に分岐してステップS24に進む。   In step S21, the width information group is selected again. Here, the uncalculated width information group B is selected. In step S22, the received light intensity acquired by the previous pixel (pixel number 0) is 0.2 and is neither 0 nor 1. Therefore, the process branches to “no” and proceeds to step S24.

ステップS24では、一つ前の画素、即ち、幅情報群Bの画素番号0は黒→白の順であるため、このフローでは“yes”となり、ステップS26に進む。ステップS26で、現在処理している画素、即ち画素番号1の白・黒順を「白→黒」と決定し、ステップS28に進む。   In step S24, since the previous pixel, that is, pixel number 0 of the width information group B is in the order of black → white, “yes” in this flow, the process proceeds to step S26. In step S26, the white / black order of the pixel currently processed, that is, pixel number 1, is determined as “white → black”, and the process proceeds to step S28.

ステップS28では、現在処理中の画素番号1の画素において「白→黒」という順に受光強度値の幅の白部と、(1−受光強度値)の幅の黒部とが配置されているとし、一つ前の画素との境界を挟む部分、即ち画素番号0と画素番号1の境界をまたぐ白部の幅の合計を計算する。図7の例では、画素番号0の白部の幅は0.2、画素番号1の白部の幅が0.6であるため、合計すると0.8、つまり「白の連続した幅情報の合計は0.8」となる(これを図にしたものが図7(F)の符号57で示した部分である)。次にステップS30に進む。   In step S28, it is assumed that a white portion having a width of the received light intensity value and a black portion having a width of (1−received light intensity value) are arranged in the order of “white → black” in the pixel of pixel number 1 being currently processed. The sum of the widths of the white portions that straddle the boundary between the pixel number 0 and the pixel number 1 is calculated. In the example of FIG. 7, the width of the white part of pixel number 0 is 0.2, and the width of the white part of pixel number 1 is 0.6, so the total is 0.8, that is, “the total of white continuous width information is 0.8”. (This is illustrated by the portion 57 in FIG. 7F). Next, the process proceeds to step S30.

ステップS30では、ステップS28で算出した「白の連続した幅情報の合計」が1以上かどうかを判断する。この計算結果は0.8であるため、ステップS30は“no”となり、ステップS32に進む。   In step S30, it is determined whether or not the “total of continuous white width information” calculated in step S28 is 1 or more. Since the calculation result is 0.8, step S30 is “no”, and the process proceeds to step S32.

ステップS32では、他に有効な幅情報群があるかどうかを確認する。本例では、幅情報群Aが存在するため、「ほかに有効な幅情報群がある」となり、“yes”に分岐してステップS33に進む。ステップS33では、直前まで計算していた幅情報群、即ち、幅情報群Bを不適切だったとして無効化し、再びステップS21に戻る。   In step S32, it is confirmed whether there is another effective width information group. In this example, since the width information group A exists, “there is another effective width information group”, the process branches to “yes” and proceeds to step S33. In step S33, the width information group calculated just before, that is, the width information group B is invalidated as inappropriate, and the process returns to step S21 again.

ステップS21では、再びで幅情報群を選ぶ。本例ではこの段階で計算すべき幅情報群が残っていないため、図4のステップS18に移る。   In step S21, the width information group is selected again. In this example, since there is no width information group to be calculated at this stage, the process proceeds to step S18 in FIG.

ステップS18では、最後に取得した受光強度の画素がイメージセンサの最後の画素かどうかを確認する。この段階ではまだ次の画素が存在するため、“no”に進み、ステップS15に移る。ステップS15で次の画素、つまり3つ目である画素番号2の受光強度を取得する。図7の例では、受光強度は0.6となる。ステップS16で受光強度が0か1かを判断し、本例では受光強度は0でも1でもないため、“no”に進んでステップS21に移る。   In step S18, it is confirmed whether or not the last received light intensity pixel is the last pixel of the image sensor. At this stage, since the next pixel still exists, the process proceeds to “no” and proceeds to step S15. In step S15, the received light intensity of the next pixel, that is, the third pixel number 2, is acquired. In the example of FIG. 7, the received light intensity is 0.6. In step S16, it is determined whether the received light intensity is 0 or 1. In this example, since the received light intensity is neither 0 nor 1, the process proceeds to "no" and proceeds to step S21.

このような処理を画素番号7(イメージセンサの最後の画素)まで行い、ステップS18の判断で最終画素と判断した場合、ステップS19に移る。このとき、有効な幅情報群が複数ある場合は、最もペンディング値が小さいものを結果として選ぶ。本例では、幅情報群Aのみが有効となったため、幅情報群Aが結果として選ばれることになる。次のステップS20で、選択した幅情報群のデータを整理して、デコードで使用できるデータ(二値化データ)にする、即ち二値化である。   Such processing is performed up to pixel number 7 (the last pixel of the image sensor), and if it is determined in step S18 that the pixel is the last pixel, the process proceeds to step S19. At this time, when there are a plurality of effective width information groups, the one having the smallest pending value is selected as a result. In this example, since only the width information group A is valid, the width information group A is selected as a result. In the next step S20, the data of the selected width information group is organized into data that can be used for decoding (binarized data), that is, binarization.

本例で計算した幅情報群A、幅情報群Bの具体的なデータと幅情報群Aの二値化データ(幅データを整理したもの)を表5にまとめる。幅情報群Aはペンディング値Pが3に増加している。幅情報群Bは2画素目(=画素1)の処理の段階で破棄されている。   Table 5 summarizes the specific data of the width information group A and the width information group B calculated in this example and the binarized data (arranged width data) of the width information group A. In the width information group A, the pending value P is increased to 3. The width information group B is discarded at the stage of processing of the second pixel (= pixel 1).

本例において、本発明の実施形態に従って二値化した結果のイメージが図7(E)のパターン56である。バーコード原像の白幅及び黒幅が画素幅より狭いにもかかわらず、従来の方法で二値化したイメージ58と比較して、画素番号4以降では、0.8の幅を正確に再現しているなど、原像52の再現度が高い。つまり、後段のデコード処理でデコードに成功する可能性が高いことを意味する。   In this example, an image resulting from binarization according to the embodiment of the present invention is a pattern 56 in FIG. Compared with the image 58 binarized by the conventional method, although the white width and black width of the barcode original image are narrower than the pixel width, the width of 0.8 is accurately reproduced after pixel number 4 The reproducibility of the original image 52 is high. In other words, it means that there is a high possibility of successful decoding in the subsequent decoding process.

このとき、二値化処理中のペンディング値の存在によって再現性が低下していることを後段のデコード処理ブロックに通知することができるため、仮に、デコードできたとしても、その結果の信頼性が低下していること、及びその度合いを数値でアウトプットすることも可能である。   At this time, since it is possible to notify the subsequent decoding processing block that the reproducibility is reduced due to the presence of the pending value during the binarization processing, even if decoding is possible, the reliability of the result is reliable. It is also possible to output a numerical value indicating the degree of decrease.

〔本発明の実施形態の処理フローの変形例〕
図4及び図5による二値化方法では、計算する量をできるだけ減らせるよう、早い段階で「不適切」な結果を振るい落とせるように、図5のステップS29とステップS30で画素境界を跨ぐ白または黒の幅の下限値を1(=画素幅と同じ)として切り分け、ステップS33で他に有効な候補があればもう一方は無効化する、という処理を設けたが、次のような方法でもよい。
[Modification of Processing Flow of Embodiment of the Present Invention]
In the binarization method according to FIG. 4 and FIG. 5, the step S29 and the step S30 in FIG. Or, the lower limit value of the black width is set to 1 (= same as the pixel width), and in step S33, if there is another valid candidate, the other is invalidated. Good.

・図5のステップS29とステップS30で画素境界を跨ぐ白または黒の幅の下限値を0.5〜1の範囲に設定して、「不適切」と判断される数を敢えて下げ、二値化処理候補(幅情報群)をできるだけ最後まで残す方法。これは原像が画素幅より小さい白又は黒が存在している場合に有効である。 In step S29 and step S30 in FIG. 5, the lower limit value of the white or black width straddling the pixel boundary is set to a range of 0.5 to 1, and the number determined to be “inappropriate” is deliberately lowered and binary Method to leave the processing candidates (width information group) as far as possible. This is effective when the original image has white or black smaller than the pixel width.

・ステップS33で、ある幅情報群を「不適切」と判断した場合でも幅情報群を敢えて無効化せず、全ての画素の処理が完了した段階でペンディング値の総計で比較し、より値の小さい方を「より信頼度の高い結果」として採用する方法。 Even if it is determined in step S33 that a certain width information group is “inappropriate”, the width information group is not deliberately invalidated, and when all the pixels have been processed, the total of the pending values are compared. The method of adopting the smaller one as “a more reliable result”.

・ステップS33で、ある幅情報群を「不適切」と判断した場合でも幅情報群を敢えて無効化せず、全ての画素の処理を行い、全ての二値化結果でデコードを試み、デコードできた二値化結果の中で、ペンディング値の総計が最も小さいものを「より信頼度の高い結果」として採用する方法。 Even if it is determined in step S33 that a certain width information group is “inappropriate”, the width information group is not deliberately invalidated, all pixels are processed, and decoding can be attempted with all binarization results. Among the binarization results, the one with the smallest total pending value is adopted as the “higher reliability result”.

〔読取限界について〕
特殊な例として、図8(A)と図8(B)を考える。図8(A)は、幅1の白と黒が交互に存在するバーコード原像で、それぞれ各画素の中央に、白・黒の境界が映り込むような状態である。一方、図8(B)は、幅0.5の白と黒が交互に存在するバーコード原像で、それぞれ各画素に白・黒が均等に映り込むような状態である。図8(A)及び図8(B)では、どちらも、全てのセンサ画素の受光強度の結果が全く同じとなる。つまり、センサ画素の受光強度の値を用いて始まる二値化処理の結果、原像が図8(A)だったのか、図8(B)だったのかは判断できない。具体的には、図8(A)及び図8(B)のそれぞれについて、本発明の実施形態である図4及び図5のフローで二値化処理を行うと、いずれも図8(A)の原像と同一の二値化結果となり、必ずしも原像を再現できない。これは、画素幅より小さい白・黒の幅を持つバーコード原像では、二値化処理結果の信頼性が低下することを意味する。
[About reading limit]
As a special example, consider FIG. 8 (A) and FIG. 8 (B). FIG. 8A shows a barcode original image in which white and black having a width of 1 are alternately present, and a white / black boundary is reflected in the center of each pixel. On the other hand, FIG. 8B is a barcode original image in which white and black having a width of 0.5 alternately exist, and a state in which white and black are evenly reflected in each pixel. In both FIG. 8A and FIG. 8B, the results of the received light intensity of all sensor pixels are exactly the same. That is, as a result of the binarization process starting from the value of the received light intensity of the sensor pixel, it cannot be determined whether the original image is FIG. 8 (A) or FIG. 8 (B). Specifically, for each of FIGS. 8A and 8B, when binarization processing is performed in the flow of FIGS. 4 and 5 according to the embodiment of the present invention, both of FIGS. The binarization result is the same as that of the original image, and the original image cannot always be reproduced. This means that the reliability of the binarization processing result is deteriorated in a barcode original image having a white / black width smaller than the pixel width.

もう一つの特殊な例として、図9(A)と図9(B)を考える。図9(A)は、不均一な幅の白と黒のパターンで、一部、0.8幅の白が存在するものである。図9(B)は図9(A)のセンサ画素の受光強度の値が全く同じとなるように図9(A)と異なる原像を想定したものである。図9(B)の原像には0.4幅の白が含まれている。   As another special example, consider FIG. 9 (A) and FIG. 9 (B). FIG. 9A shows a white and black pattern with non-uniform width, in which 0.8-width white is partially present. FIG. 9B assumes an original image different from FIG. 9A so that the light reception intensity values of the sensor pixels in FIG. 9A are exactly the same. The original image in FIG. 9B includes 0.4 width white.

図9(A)及び図9(B)のそれぞれについて、本発明の実施形態である図4及び図5のフローで二値化処理を行うと、いずれも図9(A)の原像と同一の二値化結果となる。これは二値化過程において想定しうる原像のなかで、より幅の太い白または黒の幅を持つ原像の方が「より正しいもの」として判断していることを意味する。図9(A)の原像は一部画素幅を下回る白が含まれていても二値化できるが、図9(B)の原像は二値化できる限界幅を下回っていて二値化できない(二値化した結果は図9(A)の原像と同じとなってしまう)。   For each of FIGS. 9A and 9B, when binarization processing is performed in the flow of FIGS. 4 and 5 which are embodiments of the present invention, both are the same as the original image of FIG. 9A. The binarization result of This means that among the original images that can be assumed in the binarization process, the original image having a wider white or black width is determined as “more correct”. Although the original image in FIG. 9A can be binarized even if some whites less than the pixel width are included, the original image in FIG. 9B is binarized because it is below the limit width that can be binarized. Cannot be done (the binarized result is the same as the original image in FIG. 9A).

〔センサ受光強度の前処理〕
現実的には、原像に対するセンサ受光強度にはノイズ成分が含まれている。また、バーコードの印刷状態や印刷のインクの状態に依存するため、白部は必ずしもセンサ受光可能値の最大値とはならず、また、黒部も必ずしもセンサ受光可能値の最小値をとはならない。
[Pre-processing of sensor light reception intensity]
Actually, the sensor light reception intensity with respect to the original image includes a noise component. Further, since it depends on the printing state of the barcode and the ink state of printing, the white portion does not necessarily become the maximum value of the sensor receivable value, and the black portion does not necessarily become the minimum value of the sensor receivable value. .

そこで、32個の画素をもつイメージセンサに、ある原像が映っている状態を考える。センサ受光可能最大値を1、センサ受光最小値を0としたときに、横軸にセンサ画素番号、縦軸に受光強度を示した例として図10のようになったとする。図10では、白部は受光強度の値で0.6〜0.8の間にノイズ成分を含んだ状態で分布している。また、黒部は受光強度の値で0.0〜0.2の間にノイズ成分を含んだ状態で分布している。   Therefore, consider a state in which a certain original image is reflected on an image sensor having 32 pixels. Assuming that the maximum sensor light receiving value is 1 and the minimum sensor light receiving value is 0, the horizontal axis represents the sensor pixel number and the vertical axis represents the received light intensity as shown in FIG. In FIG. 10, the white portions are distributed in a state including a noise component between 0.6 and 0.8 in terms of the value of received light intensity. Further, the black portion is distributed in a state including a noise component between 0.0 and 0.2 as a value of the received light intensity.

この状態では、本発明の実施形態による二値化方法には利用しにくいため、センサ受光強度の最大値を1、最小値を0となるように規格化する。センサ画素番号をx、その受光強度をf(x)とし、その最大値をf(x)max、最小値をf(x) minとすると、センサ受光強度の最大値を1、最小値を0となるように規格化した値g(x)は、
となる。g(x)を図にしたものが図11である。これで最大値を1、最小値を0とできるが、ノイズ成分が残っているため、g(x)に対して、15%の幅をノイズと想定し、0.85以上の値であれば1と見なし、また、0.15以下の値であれば0と見なすことによるノイズ除去を行う。その結果が図12である。図12は白部が1、黒部が0、その境界は中間値をとるような状態となり、本発明の実施形態による二値化処理に適した状態になる。
In this state, since it is difficult to use the binarization method according to the embodiment of the present invention, normalization is performed so that the maximum value of the received light intensity of the sensor is 1 and the minimum value is 0. If the sensor pixel number is x, the received light intensity is f (x), the maximum value is f (x) max , and the minimum value is f (x) min , the maximum value of the sensor received light intensity is 1 and the minimum value is 0. The value g (x) normalized so that
It becomes. FIG. 11 illustrates g (x). The maximum value can be set to 1 and the minimum value can be set to 0. However, since the noise component remains, it is assumed that the width of 15% of g (x) is noise, and 1 if the value is 0.85 or more. In addition, noise removal is performed by regarding it as 0 if the value is 0.15 or less. The result is shown in FIG. In FIG. 12, the white portion is 1, the black portion is 0, and the boundary thereof takes an intermediate value, which is suitable for binarization processing according to the embodiment of the present invention.

このように、実際にイメージセンサで取得される受光強度を二値化しやすい状態に前処理してから、本発明の実施形態による二値化を行っても良い。   As described above, the binarization according to the embodiment of the present invention may be performed after pre-processing in a state in which the received light intensity actually acquired by the image sensor is easily binarized.

本発明の実施形態における二値化方法では、バーコード読取装置のイメージセンサで撮像されたバーコードの撮像画像について画素毎の受光強度を分析し、対象の画素の受光強度が白部と黒部の中間の値をとる場合に、当該画素内にバーコードの白部と黒部の境界が存在すると判断した上で、当該画素とそれに隣接する画素での受光強度の増減関係と中間の値とに基づいて当該画素内における白黒順序及び境界位置を決定することにより、従来想定されていた最小分解能より小さい幅の二値化が可能となった。   In the binarization method in the embodiment of the present invention, the received light intensity of each pixel is analyzed for the barcode captured image captured by the image sensor of the barcode reader, and the received light intensity of the target pixel is the white portion and the black portion. When taking an intermediate value, it is determined that there is a boundary between the white portion and the black portion of the barcode in the pixel, and based on the increase / decrease relationship of the received light intensity between the pixel and the adjacent pixel and the intermediate value Thus, by determining the black and white order and the boundary position within the pixel, binarization with a width smaller than the minimum resolution assumed in the past can be realized.

従来のバーコード読取装置ではリニアイメージセンサの3画素分程度の幅が検出できる限界であったが、本発明の実施形態によるバーコード読取装置では1画素分程度の幅も検出できるようになった。   Although the conventional bar code reader has a limit that can detect the width of about 3 pixels of the linear image sensor, the bar code reader according to the embodiment of the present invention can also detect the width of about 1 pixel. .

なお、上記のバーコード読取装置は、ハードウェア、ソフトウェア又はこれらの組合せにより実現することができる。また、上記のバーコード読取方法も、ハードウェア、ソフトウェア又はこれらに組合せにより実現することができる。ここで、ソフトウェアによって実現されるとは、コンピュータがプログラムを読み込んで実行することにより実現されることを意味する。   Note that the above barcode reader can be realized by hardware, software, or a combination thereof. The above barcode reading method can also be realized by hardware, software, or a combination thereof. Here, “realized by software” means realized by a computer reading and executing a program.

プログラムは、様々なタイプの非一時的なコンピュータ可読媒体(non-transitory computer readable medium)を用いて格納され、コンピュータに供給することができる。非一時的なコンピュータ可読媒体は、様々なタイプの実体のある記録媒体(tangible storage medium)を含む。非一時的なコンピュータ可読媒体の例は、磁気記録媒体(例えば、フレキシブルディスク、磁気テープ、ハードディスクドライブ)、光磁気記録媒体(例えば、光磁気ディスク)、CD−ROM(Read Only Memory)、CD−R、CD−R/W、半導体メモリ(例えば、マスクROM、PROM(Programmable ROM)、EPROM(Erasable PROM)、フラッシュROM、RAM(random access memory))を含む。また、プログラムは、様々なタイプの一時的なコンピュータ可読媒体(transitory computer readable medium)によってコンピュータに供給されてもよい。一時的なコンピュータ可読媒体の例は、電気信号、光信号、及び電磁波を含む。一時的なコンピュータ可読媒体は、電線及び光ファイバ等の有線通信路、又は無線通信路を介して、プログラムをコンピュータに供給できる。   The program may be stored using various types of non-transitory computer readable media and supplied to the computer. Non-transitory computer readable media include various types of tangible storage media. Examples of non-transitory computer readable media include magnetic recording media (for example, flexible disks, magnetic tapes, hard disk drives), magneto-optical recording media (for example, magneto-optical disks), CD-ROMs (Read Only Memory), CD- R, CD-R / W, semiconductor memory (for example, mask ROM, PROM (Programmable ROM), EPROM (Erasable PROM), flash ROM, RAM (random access memory)). The program may also be supplied to the computer by various types of transitory computer readable media. Examples of transitory computer readable media include electrical signals, optical signals, and electromagnetic waves. The temporary computer-readable medium can supply the program to the computer via a wired communication path such as an electric wire and an optical fiber, or a wireless communication path.

上記の実施形態の一部又は全部は、以下の付記のようにも記載されうるが、以下には限られない。   A part or all of the above-described embodiment can be described as in the following supplementary notes, but is not limited thereto.

(付記1)
バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理するプロセッサを備え、前記プロセッサは二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とするバーコード読取装置。
(Appendix 1)
A processor that binarizes the captured image for each pixel in accordance with the light reception intensity of each pixel of the image sensor that has captured the barcode, and the processor has a light reception intensity of the target pixel of the binarization process that is the entire pixel When taking an intermediate value between the first received light intensity corresponding to the white portion of the code and the second received light intensity corresponding to the black portion, a boundary between the white portion and the black portion of the barcode exists in the target pixel. And determining the black-and-white order and the boundary position in the target pixel based on the increase / decrease relationship of the received light intensity in the target pixel and its adjacent pixels and the intermediate value.

(付記2)
前記プロセッサは、前記対象画素が前記中間の値の受光強度を有する場合、前記隣接画素に対して前記対象画素の受光強度が増加しているとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素に対して前記対象画素の受光強度が減少しているとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする付記1に記載のバーコード読取装置。
(Appendix 2)
When the target pixel has the intermediate value of received light intensity, the processor has a black portion from the adjacent pixel side in the target pixel when the received light intensity of the target pixel is increased with respect to the adjacent pixel. When the received light intensity of the target pixel is reduced with respect to the adjacent pixel, the order of the white portion and the black portion from the adjacent pixel side in the target pixel is determined. The barcode reading apparatus according to appendix 1, wherein the barcode reading apparatus is determined to be disposed at the position.

(付記3)
前記プロセッサは、前記対象画素と前記隣接画素とが前記中間の値の受光強度を有する場合、前記隣接画素での白黒順序が前記対象画素の側から黒部と白部の順序であるとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素での白黒順序が前記対象画素の側から白部と黒部の順序であるとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする付記1又は2に記載のバーコード読取装置。
(Appendix 3)
The processor, when the target pixel and the adjacent pixel have the light reception intensity of the intermediate value, when the black and white order in the adjacent pixel is the order of the black portion and the white portion from the target pixel side, the target In the pixel, it is determined that the black portion and the white portion are arranged in the order from the adjacent pixel side, and when the black and white order in the adjacent pixel is the order of the white portion and the black portion from the target pixel side, the target The barcode reading apparatus according to appendix 1 or 2, wherein it is determined that a white portion and a black portion are arranged in this order from the adjacent pixel side in the pixel.

(付記4)
前記プロセッサは、前記対象画素内での白黒順序と前記第1受光強度又は前記第2受光強度に対する前記対象画素の受光強度の比とに基づいて前記対象画素内での白部と黒部の境界位置を決定することを特徴とする付記1〜3のいずれか1に記載のバーコード読取装置。
(Appendix 4)
The processor determines a boundary position between a white portion and a black portion in the target pixel based on a black and white order in the target pixel and a ratio of the received light intensity of the target pixel to the first received light intensity or the second received light intensity. The barcode reader according to any one of appendices 1 to 3, wherein the barcode reader is determined.

(付記5)
前記プロセッサは、前記対象画素が二値化処理の最初の画素である場合、前記対象画素内における前記隣接画素の側からの白黒順序が白部から黒部に変わる第1初期条件と黒部から白部に変わる第2初期条件とを暫定的に定めておき、両初期条件それぞれの下で後続画素について二値化処理を行っていき夫々の二値化データ群を取得し、所定の判定基準に基づいてどちらかの二値化データ群を選択することを特徴とする付記1〜4のいずれか1に記載のバーコード読取装置。
(Appendix 5)
When the target pixel is the first pixel in the binarization process, the processor sets a first initial condition in which the black and white order from the adjacent pixel side in the target pixel changes from white to black, and black to white The second initial condition to be changed to tentatively is determined, binarization processing is performed on the subsequent pixels under each of the initial conditions, and each binarized data group is acquired, and based on a predetermined determination criterion The barcode reading apparatus according to any one of appendices 1 to 4, wherein one of the binarized data groups is selected.

(付記6)
前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する個数が少ない方の二値化データ群を選択するというものである付記5に記載のバーコード読取装置。
(Appendix 6)
The determination criterion is to obtain the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and to binarize the smaller number of the width existing within a predetermined discarding range. The barcode reader according to appendix 5, wherein the data group is selected.

(付記7)
前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する二値化データ群を破棄するというものである付記5に記載のバーコード読取装置。
(Appendix 7)
The determination criterion obtains the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and discards the binarized data group whose width is within a predetermined discarding range. The bar code reader according to appendix 5, wherein

(付記8)
バーコードに光を照射する照射光源と、
前記バーコードからの反射光をイメージセンサ上に結像する集光レンズと、
前記結像されたバーコードの映像に対し画素毎に受光強度を測定するイメージセンサと、
を更に備えことを特徴とする付記1〜7のいずれか1に記載のバーコード読取装置。
(Appendix 8)
An illumination light source for illuminating the barcode;
A condensing lens that focuses the reflected light from the barcode on an image sensor;
An image sensor that measures received light intensity for each pixel with respect to the image of the imaged barcode;
The barcode reader according to any one of appendices 1 to 7, further comprising:

(付記9)
前記プロセッサは、更に、二値化処理により得られた二値化データに対してデコード処理を行うことを特徴とする付記1〜8のいずれか1に記載のバーコード読取装置。
(Appendix 9)
The barcode reading apparatus according to any one of appendices 1 to 8, wherein the processor further performs a decoding process on the binarized data obtained by the binarization process.

(付記10)
前記プロセッサは、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する個数の情報に基づいて、前記デコード処理を行って取得できたデコードデータのうち、前記個数が少ない方のデコードデータを選択することを特徴とする付記5を引用する付記9に記載のバーコード読取装置。
(Appendix 10)
The processor obtains the width of the white portion and the black portion of the barcode for each of the obtained two binarized data groups, and performs the decoding based on the number of information whose width is within a predetermined discarding range. The barcode reading apparatus according to supplementary note 9, which cites supplementary note 5, wherein the decoded data having a smaller number is selected from the decoded data obtained by performing the processing.

(付記11)
前記プロセッサは、更に、前記イメージセンサの各画素にて測定された受光強度に対して最大値1及び最小値0となるように規格化し、所定の第1閾値以上であれば1と見なし、所定の第2閾値以下であれば0と見なすノイズ除去処理を行うことを特徴とする付記1〜10のいずれか1に記載のバーコード読取装置。
(Appendix 11)
The processor further normalizes the received light intensity measured at each pixel of the image sensor to have a maximum value of 1 and a minimum value of 0, and considers it as 1 if it is greater than or equal to a predetermined first threshold. The barcode reading apparatus according to any one of appendices 1 to 10, wherein a noise removal process that considers 0 is performed if the second threshold value is less than the second threshold value.

(付記12)
バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理するステップを含み、前記ステップにおいて二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とするバーコード読取方法。
(Appendix 12)
Including a step of binarizing the captured image for each pixel in accordance with the light reception intensity of each pixel of the image sensor that has imaged the barcode, and the light reception intensity of the target pixel of the binarization process in the above step is a bar When taking an intermediate value between the first received light intensity corresponding to the white portion of the code and the second received light intensity corresponding to the black portion, a boundary between the white portion and the black portion of the barcode exists in the target pixel. And determining the black and white order and the boundary position in the target pixel based on the increase / decrease relationship of the received light intensity in the target pixel and its adjacent pixels and the intermediate value.

(付記13)
前記ステップでは、前記対象画素が前記中間の値の受光強度を有する場合、前記隣接画素に対して前記対象画素の受光強度が増加しているとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素に対して前記対象画素の受光強度が減少しているとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする付記12に記載のバーコード読取方法。
(Appendix 13)
In the step, when the target pixel has the light reception intensity of the intermediate value, when the light reception intensity of the target pixel is increased with respect to the adjacent pixel, a black portion is formed from the adjacent pixel side in the target pixel. When the received light intensity of the target pixel is reduced with respect to the adjacent pixel, the order of the white portion and the black portion from the adjacent pixel side in the target pixel is determined. 13. The barcode reading method according to appendix 12, wherein the barcode reading method is determined to be arranged in the above manner.

(付記14)
前記ステップでは、前記対象画素と前記隣接画素とが前記中間の値の受光強度を有する場合、前記隣接画素での白黒順序が前記対象画素の側から黒部と白部の順序であるとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素での白黒順序が前記対象画素の側から白部と黒部の順序であるとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする付記12又は13に記載のバーコード読取方法。
(Appendix 14)
In the step, when the target pixel and the adjacent pixel have the intermediate value of received light intensity, when the black and white order in the adjacent pixel is the order of the black portion and the white portion from the target pixel side, the target In the pixel, it is determined that the black portion and the white portion are arranged in the order from the adjacent pixel side, and when the black and white order in the adjacent pixel is the order of the white portion and the black portion from the target pixel side, the target 14. The barcode reading method according to appendix 12 or 13, wherein in the pixel, it is determined that the white portion and the black portion are arranged in this order from the adjacent pixel side.

(付記15)
前記ステップでは、前記対象画素内での白黒順序と前記第1受光強度又は前記第2受光強度に対する前記対象画素の受光強度の比とに基づいて前記対象画素内での白部と黒部の境界位置を決定することを特徴とする付記12〜14のいずれか1に記載のバーコード読取方法。
(Appendix 15)
In the step, the boundary position between the white portion and the black portion in the target pixel based on the black-and-white order in the target pixel and the ratio of the received light intensity of the target pixel to the first received light intensity or the second received light intensity The barcode reading method according to any one of appendices 12 to 14, wherein the barcode is determined.

(付記16)
前記ステップでは、前記対象画素が二値化処理の最初の画素である場合、前記対象画素内における前記隣接画素の側からの白黒順序が白部から黒部に変わる第1初期条件と黒部から白部に変わる第2初期条件とを暫定的に定めておき、両初期条件それぞれの下で後続画素について二値化処理を行っていき夫々の二値化データ群を取得し、所定の判定基準に基づいてどちらかの二値化データ群を選択することを特徴とする付記12〜15のいずれか1に記載のバーコード読取方法。
(Appendix 16)
In the step, when the target pixel is the first pixel of the binarization process, a first initial condition in which the black and white order from the adjacent pixel side in the target pixel changes from white to black, and black to white The second initial condition to be changed to tentatively is determined, binarization processing is performed on the subsequent pixels under each of the initial conditions, and each binarized data group is acquired, and based on a predetermined determination criterion The barcode reading method according to any one of appendices 12 to 15, wherein one of the binarized data groups is selected.

(付記17)
前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する個数が少ない方の二値化データ群を選択するというものである付記16に記載のバーコード読取方法。
(Appendix 17)
The determination criterion is to obtain the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and to binarize the smaller number of the width existing within a predetermined discarding range. The barcode reading method according to supplementary note 16, wherein the data group is selected.

(付記18)
前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する二値化データ群を破棄するというものである付記16に記載のバーコード読取方法。
(Appendix 18)
The determination criterion obtains the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and discards the binarized data group whose width is within a predetermined discarding range. The barcode reading method according to attachment 16, wherein

(付記19)
バーコードに光を照射するステップと、
前記バーコードからの反射光をイメージセンサ上に結像するステップと、
前記結像されたバーコードの映像に対し画素毎に受光強度を測定するステップと、
を更に含むことを特徴とする付記12〜18のいずれか1に記載のバーコード読取方法。
(Appendix 19)
Illuminating the barcode with light;
Imaging reflected light from the barcode on an image sensor;
Measuring the received light intensity for each pixel with respect to the image of the imaged barcode;
The barcode reading method according to any one of supplementary notes 12 to 18, further comprising:

(付記20)
前記二値化処理するステップでは、更に、二値化処理により得られた二値化データに対してデコード処理を行うことを特徴とする付記12〜19のいずれか1に記載のバーコード読取方法。
(Appendix 20)
The barcode reading method according to any one of appendices 12 to 19, wherein in the binarization processing step, decoding processing is further performed on the binarized data obtained by the binarization processing. .

(付記21)
前記二値化処理するステップでは、更に、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する個数の情報に基づいて、前記デコード処理を行って取得できたデコードデータのうち、前記個数が少ない方のデコードデータを選択することを特徴とする付記16を引用する付記20に記載のバーコード読取方法。
(Appendix 21)
In the binarization processing step, the width of the white portion and the black portion of the barcode is obtained for each of the obtained two binarized data groups, and the number of the widths existing within a predetermined discarding range is obtained. The barcode reading method according to supplementary note 20 quoting supplementary note 16, wherein the decoded data having the smaller number is selected from the decoded data obtained by performing the decoding process based on the information.

(付記22)
前記二値化処理するステップでは、更に、前記イメージセンサの各画素にて測定された受光強度に対して最大値1及び最小値0となるように規格化し、所定の第1閾値以上であれば1と見なし、所定の第2閾値以下であれば0と見なすノイズ除去処理を行うことを特徴とする付記12〜21のいずれか1に記載のバーコード読取方法。
(Appendix 22)
In the binarization processing step, the received light intensity measured at each pixel of the image sensor is normalized so that the maximum value is 1 and the minimum value is 0. The barcode reading method according to any one of appendices 12 to 21, wherein a noise removal process is performed in which it is assumed that the noise is considered to be 1 and 0 if it is equal to or less than a predetermined second threshold value.

(付記23)
コンピュータを、バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理する手段として機能させるためのバーコード読取プログラムであって、前記手段により、二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とするバーコード読取プログラム。
(Appendix 23)
A barcode reading program for causing a computer to function as a means for binarizing a captured image for each pixel in accordance with the received light intensity of each pixel of an image sensor that has imaged a barcode. If the light reception intensity of the target pixel of the conversion processing takes an intermediate value between the first light reception intensity when the entire pixel corresponds to the white portion of the barcode and the second light reception intensity when it corresponds to the black portion, the target It is determined that there is a boundary between the white portion and the black portion of the barcode in the pixel, and the order of black and white and the boundary in the target pixel based on the relationship between the increase and decrease in received light intensity in the target pixel and its adjacent pixels A bar code reading program for determining a position.

(付記24)
前記手段は、前記対象画素が前記中間の値の受光強度を有する場合、前記隣接画素に対して前記対象画素の受光強度が増加しているとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素に対して前記対象画素の受光強度が減少しているとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする付記23に記載のバーコード読取プログラム。
(Appendix 24)
When the target pixel has the intermediate value of received light intensity, the means has a black portion from the adjacent pixel side in the target pixel when the received light intensity of the target pixel is increased with respect to the adjacent pixel. When the received light intensity of the target pixel is reduced with respect to the adjacent pixel, the order of the white portion and the black portion from the adjacent pixel side in the target pixel is determined. The bar code reading program according to appendix 23, wherein the bar code reading program is determined to be arranged in the above.

(付記25)
前記手段は、前記対象画素と前記隣接画素とが前記中間の値の受光強度を有する場合、前記隣接画素での白黒順序が前記対象画素の側から黒部と白部の順序であるとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素での白黒順序が前記対象画素の側から白部と黒部の順序であるとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする付記23又は24に記載のバーコード読取プログラム。
(Appendix 25)
In the case where the target pixel and the adjacent pixel have a light reception intensity of the intermediate value, when the black and white order in the adjacent pixel is an order of a black portion and a white portion from the target pixel side, the means In the pixel, it is determined that the black portion and the white portion are arranged in the order from the adjacent pixel side, and when the black and white order in the adjacent pixel is the order of the white portion and the black portion from the target pixel side, the target 25. The barcode reading program according to appendix 23 or 24, wherein the barcode reading program determines that the pixels are arranged in the order of a white portion and a black portion from the adjacent pixel side in the pixel.

(付記26)
前記手段は、前記対象画素内での白黒順序と前記第1受光強度又は前記第2受光強度に対する前記対象画素の受光強度の比とに基づいて前記対象画素内での白部と黒部の境界位置を決定することを特徴とする付記23〜25のいずれか1に記載のバーコード読取プログラム。
(Appendix 26)
The means is configured to determine a boundary position between a white portion and a black portion in the target pixel based on a black and white order in the target pixel and a ratio of the received light intensity of the target pixel to the first received light intensity or the second received light intensity. The barcode reading program according to any one of appendices 23 to 25, wherein the barcode reading program is determined.

(付記27)
前記手段は、前記対象画素が二値化処理の最初の画素である場合、前記対象画素内における前記隣接画素の側からの白黒順序が白部から黒部に変わる第1初期条件と黒部から白部に変わる第2初期条件とを暫定的に定めておき、両初期条件それぞれの下で後続画素について二値化処理を行っていき夫々の二値化データ群を取得し、所定の判定基準に基づいてどちらかの二値化データ群を選択することを特徴とする付記23〜26のいずれか1に記載のバーコード読取プログラム。
(Appendix 27)
When the target pixel is the first pixel in the binarization process, the means includes a first initial condition in which the black and white order from the adjacent pixel side in the target pixel changes from white to black, and black to white The second initial condition to be changed to tentatively is determined, binarization processing is performed on the subsequent pixels under each of the initial conditions, and each binarized data group is acquired, and based on a predetermined determination criterion 27. The barcode reading program according to any one of appendices 23 to 26, wherein one of the binarized data groups is selected.

(付記28)
前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する個数が少ない方の二値化データ群を選択するというものである付記27に記載のバーコード読取プログラム。
(Appendix 28)
The determination criterion is to obtain the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and to binarize the smaller number of the width existing within a predetermined discarding range. 28. The bar code reading program according to appendix 27, wherein the data group is selected.

(付記29)
前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する二値化データ群を破棄するというものである付記27に記載のバーコード読取プログラム。
(Appendix 29)
The determination criterion obtains the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and discards the binarized data group whose width is within a predetermined discarding range. The barcode reading program according to supplementary note 27.

(付記30)
前記手段は、更に、二値化処理により得られた二値化データに対してデコード処理を行うことを特徴とする付記23〜29のいずれか1に記載のバーコード読取プログラム。
(Appendix 30)
The barcode reading program according to any one of appendices 23 to 29, wherein the means further performs a decoding process on the binarized data obtained by the binarization process.

(付記31)
前記手段は、更に、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する個数の情報に基づいて、前記デコード処理を行って取得できたデコードデータのうち、前記個数が少ない方のデコードデータを選択することを特徴とする付記27を引用する付記30に記載のバーコード読取プログラム。
(Appendix 31)
The means further obtains the width of the white portion and the black portion of the barcode for each of the obtained two binarized data groups, and based on the information on the number of the width existing within a predetermined discarding range, The barcode reading program according to supplementary note 30, which cites supplementary note 27, wherein the decoded data having the smaller number is selected from the decoded data obtained by performing the decoding process.

(付記32)
前記手段は、更に、前記イメージセンサの各画素にて測定された受光強度に対して最大値1及び最小値0となるように規格化し、所定の第1閾値以上であれば1と見なし、所定の第2閾値以下であれば0と見なすノイズ除去処理を行うことを特徴とする付記23〜31のいずれか1に記載のバーコード読取プログラム。
(Appendix 32)
The means further normalizes the received light intensity measured at each pixel of the image sensor to have a maximum value of 1 and a minimum value of 0, and if it is equal to or greater than a predetermined first threshold value, it is regarded as 1. 32. The bar code reading program according to any one of appendices 23 to 31, wherein a noise removal process that considers 0 is performed if the second threshold value is less than the second threshold value.

本発明は、バーコード読取装置の二値化プログラムの一部の処理に利用できる。原像が白と黒、あるいは、明部と暗部の二値となるものであれば、バーコード読取装置以外の用途でも応用可能である。   The present invention can be used for a part of the binarization program of the barcode reader. As long as the original image has a binary value of white and black, or a bright portion and a dark portion, the present invention can be applied to applications other than the barcode reader.

1 バーコード読取装置
2 照明光源
3 反射ミラー
4 集光レンズ
5 イメージセンサ
6 プロセッサ
7 バーコード
DESCRIPTION OF SYMBOLS 1 Bar code reader 2 Illumination light source 3 Reflection mirror 4 Condensing lens 5 Image sensor 6 Processor 7 Bar code

Claims (10)

バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理するプロセッサを備え、前記プロセッサは二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とするバーコード読取装置。   A processor that binarizes the captured image for each pixel in accordance with the light reception intensity of each pixel of the image sensor that has captured the barcode, and the processor has a light reception intensity of the target pixel of the binarization process that is the entire pixel When taking an intermediate value between the first received light intensity corresponding to the white portion of the code and the second received light intensity corresponding to the black portion, a boundary between the white portion and the black portion of the barcode exists in the target pixel. And determining the black-and-white order and the boundary position in the target pixel based on the increase / decrease relationship of the received light intensity in the target pixel and its adjacent pixels and the intermediate value. 前記プロセッサは、前記対象画素が前記中間の値の受光強度を有する場合、前記隣接画素に対して前記対象画素の受光強度が増加しているとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素に対して前記対象画素の受光強度が減少しているとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする請求項1に記載のバーコード読取装置。   When the target pixel has the intermediate value of received light intensity, the processor has a black portion from the adjacent pixel side in the target pixel when the received light intensity of the target pixel is increased relative to the adjacent pixel. When the received light intensity of the target pixel is reduced with respect to the adjacent pixel, the order of the white portion and the black portion from the adjacent pixel side in the target pixel is determined. The bar code reader according to claim 1, wherein the bar code reader is determined to be disposed at the position. 前記プロセッサは、前記対象画素と前記隣接画素とが前記中間の値の受光強度を有する場合、前記隣接画素での白黒順序が前記対象画素の側から黒部と白部の順序であるとき、前記対象画素内において前記隣接画素の側から黒部と白部の順序で配置されていると判定し、前記隣接画素での白黒順序が前記対象画素の側から白部と黒部の順序であるとき、前記対象画素内において前記隣接画素の側から白部と黒部の順序で配置されていると判定することを特徴とする請求項1又は2に記載のバーコード読取装置。   The processor, when the target pixel and the adjacent pixel have the light reception intensity of the intermediate value, when the black and white order in the adjacent pixel is the order of the black portion and the white portion from the target pixel side, the target In the pixel, it is determined that the black portion and the white portion are arranged in the order from the adjacent pixel side, and when the black and white order in the adjacent pixel is the order of the white portion and the black portion from the target pixel side, the target 3. The barcode reading apparatus according to claim 1, wherein the barcode reading device is determined to be arranged in the order of a white portion and a black portion from a side of the adjacent pixel in the pixel. 前記プロセッサは、前記対象画素内での白黒順序と前記第1受光強度又は前記第2受光強度に対する前記対象画素の受光強度の比とに基づいて前記対象画素内での白部と黒部の境界位置を決定することを特徴とする請求項1〜3のいずれか1項に記載のバーコード読取装置。   The processor determines a boundary position between a white portion and a black portion in the target pixel based on a black and white order in the target pixel and a ratio of the received light intensity of the target pixel to the first received light intensity or the second received light intensity. The barcode reader according to claim 1, wherein the barcode reader is determined. 前記プロセッサは、前記対象画素が二値化処理の最初の画素である場合、前記対象画素内における前記隣接画素の側からの白黒順序が白部から黒部に変わる第1初期条件と黒部から白部に変わる第2初期条件とを暫定的に定めておき、両初期条件それぞれの下で後続画素について二値化処理を行っていき夫々の二値化データ群を取得し、所定の判定基準に基づいてどちらかの二値化データ群を選択することを特徴とする請求項1〜4のいずれか1項に記載のバーコード読取装置。   When the target pixel is the first pixel in the binarization process, the processor sets a first initial condition in which the black and white order from the adjacent pixel side in the target pixel changes from white to black, and black to white The second initial condition to be changed to tentatively is determined, binarization processing is performed on the subsequent pixels under each of the initial conditions, and each binarized data group is acquired, and based on a predetermined determination criterion The bar code reader according to claim 1, wherein one of the binarized data groups is selected. 前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する個数が少ない方の二値化データ群を選択するというものである請求項5に記載のバーコード読取装置。   The determination criterion is to obtain the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and to binarize the smaller number of the width existing within a predetermined discarding range. 6. The barcode reader according to claim 5, wherein a data group is selected. 前記判定基準は、取得された2つの二値化データ群の夫々についてバーコードの白部及び黒部の幅を夫々求め、該幅が所定の破棄範囲内に存在する二値化データ群を破棄するというものである請求項5に記載のバーコード読取装置。   The determination criterion obtains the width of the white portion and the black portion of the barcode for each of the two acquired binarized data groups, and discards the binarized data group whose width is within a predetermined discarding range. The barcode reader according to claim 5. バーコードに光を照射する照射光源と、
前記バーコードからの反射光をイメージセンサ上に結像する集光レンズと、
前記結像されたバーコードの映像に対し画素毎に受光強度を測定するイメージセンサと、
を更に備えことを特徴とする請求項1〜7のいずれか1項に記載のバーコード読取装置。
An illumination light source for illuminating the barcode;
A condensing lens that focuses the reflected light from the barcode on an image sensor;
An image sensor that measures received light intensity for each pixel with respect to the image of the imaged barcode;
The barcode reader according to any one of claims 1 to 7, further comprising:
バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理するステップを含み、前記ステップにおいて二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とするバーコード読取方法。   Including a step of binarizing the captured image for each pixel in accordance with the light reception intensity of each pixel of the image sensor that has imaged the barcode, and the light reception intensity of the target pixel of the binarization process in the above step is a bar When taking an intermediate value between the first received light intensity corresponding to the white portion of the code and the second received light intensity corresponding to the black portion, a boundary between the white portion and the black portion of the barcode exists in the target pixel. And determining the black and white order and the boundary position in the target pixel based on the increase / decrease relationship of the received light intensity in the target pixel and its adjacent pixels and the intermediate value. コンピュータを、バーコードを撮像したイメージセンサの各画素の受光強度に応じて撮像画像を画素毎に二値化処理する手段として機能させるためのバーコード読取プログラムであって、前記手段により、二値化処理の対象画素の受光強度が1画素全体がバーコードの白部に相当するときの第1受光強度と黒部に相当するときの第2受光強度との中間の値をとる場合に、前記対象画素内にバーコードの白部と黒部の境界が存在すると判断し、前記対象画素とその隣接画素での受光強度の増減関係と前記中間の値とに基づいて前記対象画素内における白黒順序及び境界位置を決定することを特徴とするバーコード読取プログラム。   A barcode reading program for causing a computer to function as a means for binarizing a captured image for each pixel in accordance with the received light intensity of each pixel of an image sensor that has imaged a barcode. If the light reception intensity of the target pixel of the conversion processing takes an intermediate value between the first light reception intensity when the entire pixel corresponds to the white portion of the barcode and the second light reception intensity when it corresponds to the black portion, the target It is determined that there is a boundary between the white portion and the black portion of the barcode in the pixel, and the order of black and white and the boundary in the target pixel based on the relationship between the increase and decrease in received light intensity in the target pixel and its adjacent pixels and the intermediate value A bar code reading program for determining a position.
JP2014053290A 2014-03-17 2014-03-17 Bar code reading apparatus, bar code reading method and bar code reading program Active JP5896488B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014053290A JP5896488B2 (en) 2014-03-17 2014-03-17 Bar code reading apparatus, bar code reading method and bar code reading program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014053290A JP5896488B2 (en) 2014-03-17 2014-03-17 Bar code reading apparatus, bar code reading method and bar code reading program

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2015211727A Division JP6083829B2 (en) 2015-10-28 2015-10-28 Bar code reading apparatus, bar code reading method and bar code reading program

Publications (2)

Publication Number Publication Date
JP2015176425A true JP2015176425A (en) 2015-10-05
JP5896488B2 JP5896488B2 (en) 2016-03-30

Family

ID=54255548

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014053290A Active JP5896488B2 (en) 2014-03-17 2014-03-17 Bar code reading apparatus, bar code reading method and bar code reading program

Country Status (1)

Country Link
JP (1) JP5896488B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113033232A (en) * 2019-12-09 2021-06-25 新唐科技股份有限公司 Image binarization method and electronic device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6152779A (en) * 1984-08-21 1986-03-15 Usac Electronics Ind Co Ltd Bar code reading process
JP2002216071A (en) * 2001-01-23 2002-08-02 Nisca Corp Optical reader and bar code reading method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6152779A (en) * 1984-08-21 1986-03-15 Usac Electronics Ind Co Ltd Bar code reading process
JP2002216071A (en) * 2001-01-23 2002-08-02 Nisca Corp Optical reader and bar code reading method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113033232A (en) * 2019-12-09 2021-06-25 新唐科技股份有限公司 Image binarization method and electronic device
CN113033232B (en) * 2019-12-09 2024-04-05 新唐科技股份有限公司 Image binarization method and electronic device

Also Published As

Publication number Publication date
JP5896488B2 (en) 2016-03-30

Similar Documents

Publication Publication Date Title
JP3115610B2 (en) High speed image capture system and method
US8668149B2 (en) Bar code reader terminal and methods for operating the same having misread detection apparatus
JP4911340B2 (en) Two-dimensional code detection system and two-dimensional code detection program
US20150144692A1 (en) System and method for indicia reading and verification
JP4058529B2 (en) Optical information reader
US8167209B2 (en) Increasing imaging quality of a bar code reader
US6478223B1 (en) Machine-readable color symbology and method and apparatus for reading same with standard readers such as laser scanners
EP1836646B1 (en) Bar code scanner decoding
US7949187B2 (en) Character string recognition method and device
US8333326B2 (en) Stacked barcode reader and stacked barcode reading method
US8718370B2 (en) Optical information-reading apparatus and optical information-reading method
US10460142B2 (en) Barcode identification method for improving decoding reliability by correcting image distortion
US9262665B2 (en) Decoding method and decoding processing device
JP5896488B2 (en) Bar code reading apparatus, bar code reading method and bar code reading program
JP4652201B2 (en) Bar code symbol information reading method and bar code symbol information reading device
JP5489247B2 (en) Bar code reader and method
JP6083829B2 (en) Bar code reading apparatus, bar code reading method and bar code reading program
JP5379626B2 (en) Stack bar code information reading method and stack bar code information reading device
JP5264956B2 (en) Two-dimensional code reading apparatus and method
JP2011197856A (en) Optical information reading device
JP2011191957A (en) Method and apparatus for reading barcode information
JP5424369B1 (en) Bar code reader, bar code reading method and bar code reading program
JP5453594B2 (en) Symbol information reading apparatus and symbol information reading method
US8840025B2 (en) Arrangement for and method of preventing symbol misreads in electro-optical readers
JP3567904B2 (en) 2D code reader

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150908

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20151028

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20160205

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160225

R150 Certificate of patent or registration of utility model

Ref document number: 5896488

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150