JP2011159317A - Device and method for reading two-dimensional code - Google Patents
Device and method for reading two-dimensional code Download PDFInfo
- Publication number
- JP2011159317A JP2011159317A JP2011089101A JP2011089101A JP2011159317A JP 2011159317 A JP2011159317 A JP 2011159317A JP 2011089101 A JP2011089101 A JP 2011089101A JP 2011089101 A JP2011089101 A JP 2011089101A JP 2011159317 A JP2011159317 A JP 2011159317A
- Authority
- JP
- Japan
- Prior art keywords
- pixel
- level difference
- dimensional code
- level
- gradation
- 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
Links
Images
Abstract
Description
本発明は、例えば商品に付されているバーコード等の2次元コードを撮像装置により撮像して取得した多階調画像データに対してしきい値を用いて2値化し、この2値化データから2次元コードに含まれる情報を読み取る2次元コード読取装置及びその方法に関する。 The present invention binarizes multi-gradation image data obtained by imaging a two-dimensional code such as a barcode attached to a product with an imaging device using a threshold value, and the binarized data. The present invention relates to a two-dimensional code reader and method for reading information contained in a two-dimensional code.
例えばCCDカメラ等の撮像装置によりバーコードや記号等を撮像し、この撮像装置から出力される映像信号を画像処理することによってバーコードや記号等を認識する2次元コード読取装置がある。このような装置では、撮像装置から出力される映像信号から多階調から成る画像データを取得し、この多値画像データを2値化して2値化データを取得する前処理が行われる。そして、2次元コード読取装置は、前処理により取得された2値化データに基づいてバーコードのデコードやパターン認識等の各種処理を行う。 For example, there is a two-dimensional code reader that recognizes a barcode, a symbol, or the like by imaging a barcode, a symbol, or the like with an imaging device such as a CCD camera and performing image processing on a video signal output from the imaging device. In such an apparatus, preprocessing for acquiring image data composed of multiple gradations from a video signal output from the imaging apparatus, binarizing the multi-value image data, and acquiring binarized data is performed. The two-dimensional code reader performs various processes such as barcode decoding and pattern recognition based on the binarized data acquired by the preprocessing.
多値画像データを2値化する技術としては、例えば平均法、Pタイル法、モード法、判別分析法等がある。これらの方法は、いずれも所定の領域内で単一のしきい値に固定して設定し、このしきい値に基づいて多値画像データを2値化する。
一方、閾値レベルを固定しない方法としては、例えば特許文献1がある。この特許文献1は、“黒”又は“白”を判断するためのしきい値レベルを固定させずにバーコードラベルの下地の濃度(白色度)に応じてしきい値レベルを設定することを開示する。
Examples of techniques for binarizing multi-valued image data include an average method, a P tile method, a mode method, and a discriminant analysis method. In any of these methods, a fixed threshold value is set within a predetermined area, and multi-value image data is binarized based on the threshold value.
On the other hand, as a method of not fixing the threshold level, there is, for example,
撮像装置により例えば商品に付されたバーコードを撮像するときには、バーコードに対して照明を行うが、この照明領域の例えば中央部では照明ムラが殆どないが、その周辺では、中央部との間に照明ムラが生じる。このような事から例えば撮像装置のフォーカス位置で撮像装置の撮像方向と照明方向とを一致させている。これにより、撮像装置は、バーコードを捉えたときに照明ムラが生じないように照明ムラの殆どない照明領域の中央部に向けて撮像領域の方向が設定される。このように撮像装置の撮像方向と照明方向とを設定しているが、照明領域の例えば中央部とその周辺との間には照明ムラが生じるために、撮像装置における撮像面上の中央部とその周辺部との間に照明ムラが生じる。しかるに、バーコードが例えばオペレータによって撮像装置における撮像面上の中央部に配置されると、バーコード上に照明ムラが生じないが、バーコードが撮像装置における撮像面上の周辺部に配置されると、バーコード上に照明ムラが生じる。 For example, when a barcode attached to a product is imaged by an imaging device, the barcode is illuminated. For example, there is almost no illumination unevenness in the central portion of the illumination area, but in the vicinity of the central portion. Lighting unevenness occurs. For this reason, for example, the imaging direction of the imaging device and the illumination direction are matched at the focus position of the imaging device. As a result, the imaging device sets the direction of the imaging region toward the center of the illumination region where there is almost no illumination unevenness so that illumination unevenness does not occur when the barcode is captured. Although the imaging direction and illumination direction of the imaging device are set in this way, illumination unevenness occurs between, for example, the central portion and the periphery of the illumination area. Illumination unevenness occurs between the peripheral portions. However, if the barcode is placed at the center on the imaging surface of the imaging device by an operator, for example, the illumination is not uneven on the barcode, but the barcode is placed at the peripheral portion on the imaging surface of the imaging device. As a result, uneven illumination occurs on the barcode.
図6は撮像装置における撮像面1上の周辺部にバーコード2が配置された場合の2値化処理を示す。このようにバーコード2が撮像装置における撮像面1上の周辺部に配置されると、バーコード2上に照明ムラが生じるために、例えばラインm上における多値画像データの階調レベルは、変動し、撮像面1上の中央部よりもその周辺部で低下している。
FIG. 6 shows a binarization process when the
このように階調レベルが変動している多値画像データに対して固定設定されたしきい値th1を用いて2値化処理すると、撮像面1上の中央部における多値画像データに対しては2値化処理してバーコード2を再現できるが、撮像面1上の周辺部すなわち図6上の右側になるに従って照度が低下するために、バーコード2に対応する多値画像データの階調レベルがしきい値th1よりも低くなり、バーコード2が在るにも拘わらずバーコード2を再現することが不可能になる。
When the binarization processing is performed using the threshold value th1 that is fixedly set for the multivalued image data with the gradation level fluctuating as described above, the multivalued image data in the central portion on the
特許文献1は、バーコードラベルの下地の濃度(白色度)に応じてしきい値レベルを設定しており、読み取る対象のバーコードの下地が所定の濃度レベルを有していることを前提とする。特にバーコード読み取り装置に商品をかざして当該商品に付されたバーコードを読み取る場合、バーコードを撮像装置の撮像面上の中央部(装置の正面)で捉えた場合には照明が均一に当たっているため2値化に支障はない。
しかしながら、特許文献1でもバーコードを撮像面上の周辺部で捉えた場合には、周辺部の照度が低下するために、上記同様に、バーコード領域の両端で多階調レベルに差が生じる。すなわち、特許文献1は、バーコードラベルの下地の濃度(白色度)に応じてしきい値レベルを設定しているが、この設定されるしきい値レベルは、撮像装置の撮像により取得されるそれぞれ異なる複数の画像データ毎に可変設定される。すなわち、複数の画像データ毎に設定される各しきい値レベルは、それぞれ図6に示すしきい値th1と同様に、1つの画像データ内で変化しない一定値を示す。このため、特許文献1であっても上記図6に示す説明と同様に、1つの画像データに対して設定されたしきい値レベルは、固定設定されたものと同一になる。従って、特許文献1に開示されているしきい値レベルを用いて2値化処理したとしても、上記同様に、撮像面上の周辺部になるに従って照度が低下するために、バーコードに対応する多値画像データの階調レベルが一定値を示すしきい値よりも低くなり、バーコードが在るにも拘わらずバーコードを再現することが不可能になる。
However, even in
本発明の目的は、撮像時の環境条件、特に照明の照度ムラの影響を受けずに安定して正確にバーコードを2値化できる2次元コード読取装置及びその方法を提供することにある。 SUMMARY OF THE INVENTION An object of the present invention is to provide a two-dimensional code reading apparatus and method that can binarize a bar code stably and accurately without being affected by environmental conditions at the time of imaging, particularly illumination unevenness of illumination.
本発明の主要な局面に係る2次元コード読取装置は、多階調画像データ中における2次元コードを読み取る方向における注目画素の階調レベルとこの注目画素よりも2次元コードを読み取る方向に少なくとも1画素前の画素の階調レベルとの変動のレベル差が予め設定された2次元コードにおける黒バー部分とその背景部分との境界を判定するための境界判定レベル差以下であるか否かを判定し、この判定の結果、レベル差が予め設定された境界判定レベル差以下であれば、しきい値を増加又は減少させ、レベル差が予め設定された境界判定レベル差以下でなければ、しきい値の増加又は減少を行わないしきい値可変設定部を具備する。 The two-dimensional code reader according to the main aspect of the present invention has at least one gradation level of a pixel of interest in the direction of reading a two-dimensional code in multi-tone image data and a direction of reading the two-dimensional code from the pixel of interest. It is determined whether or not the level difference of fluctuation from the gradation level of the pixel before the pixel is equal to or smaller than the boundary determination level difference for determining the boundary between the black bar portion and the background portion in the preset two-dimensional code. As a result of this determination, if the level difference is less than or equal to a preset boundary determination level difference, the threshold value is increased or decreased, and if the level difference is not less than or equal to the preset boundary determination level difference, the threshold value is increased. A threshold variable setting unit that does not increase or decrease the value is provided.
本発明の主要な局面に係る2次元コード読取方法は、多階調画像データ中における2次元コードを読み取る方向における注目画素の階調レベルとこの注目画素よりも2次元コードを読み取る方向に少なくとも1画素前の画素の階調レベルとの変動のレベル差が予め設定された2次元コードにおける黒バー部分とその背景部分との境界を判定するための境界判定レベル差以下であるか否かを判定し、この判定の結果、レベル差が予め設定された境界判定レベル差以下であれば、しきい値を増加又は減少させ、レベル差が予め設定された境界判定レベル差以下でなければ、しきい値の増加又は減少を行わない。 The two-dimensional code reading method according to the main aspect of the present invention includes at least one gradation level of a target pixel in a direction of reading a two-dimensional code in multi-tone image data and a direction of reading the two-dimensional code from the target pixel. It is determined whether or not the level difference of fluctuation from the gradation level of the pixel before the pixel is equal to or smaller than the boundary determination level difference for determining the boundary between the black bar portion and the background portion in the preset two-dimensional code. As a result of this determination, if the level difference is less than or equal to a preset boundary determination level difference, the threshold value is increased or decreased, and if the level difference is not less than or equal to the preset boundary determination level difference, the threshold value is increased. Do not increase or decrease the value.
本発明によれば、撮像時の環境条件、特に照明の照度ムラの影響を受けずに安定して正確にバーコードを2値化できる2次元コード読取装置及びその方法を提供できる。 According to the present invention, it is possible to provide a two-dimensional code reading apparatus and method capable of binarizing a bar code stably and accurately without being affected by environmental conditions at the time of imaging, in particular, illuminance unevenness of illumination.
以下、本発明の一実施の形態について図面を参照して説明する。
図1は2次元コード読取装置の構成図を示す。この2次元コード読取装置は、例えば電子キャッシュレジスタに用いられる。この2次元コード読取装置は、制御部本体としてCPU(Central Processing Unit)10を搭載している。このCPU100には、ROM(Read Only Memory)11と、RAM(Random Access Memory)12と、通信インタフェース(通信I/F)13と、撮像部14とが接続されると共に、CPU100からの指令を受けて2値化処理部15と、デコード部16と、しきい値可変設定部17とが動作するものとなっている。
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 shows a configuration diagram of a two-dimensional code reader. This two-dimensional code reader is used for an electronic cash register, for example. This two-dimensional code reader is equipped with a CPU (Central Processing Unit) 10 as a control unit main body. The CPU 100 is connected to a ROM (Read Only Memory) 11, a RAM (Random Access Memory) 12, a communication interface (communication I / F) 13, and an
ROM11には、例えば電子キャッシュレジスタの業務を実行させるための業務プログラムや2次元コード読取プログラムが予め格納されている。2次元コード読取プログラムは、例えば商品18に付されたバーコード2を撮像部14により撮像して多階調画像データを取得し、この多階調画像データに対してしきい値th2を用いて2値化させ、この2値化データからバーコード2に含まれる商品18の情報を読み取る場合、多階調画像データにおける階調レベルの変動に応じてしきい値th2を可変設定させ、この可変設定させたしきい値th2を用いて多階調画像データを2値化させる。
In the
RAM12は、各種データを一時記憶するためのワークエリアが形成され、例えば撮像部14の撮像により取得された多階調画像データDaを当該ワークエリアに一時記憶したり、デコード部16によりデコードされたバーコード2に含む情報等をワークエリアに一時記憶する。
通信I/F13には、図示しない伝送路を通して例えばPOSシステムのサーバ等の外部機器が接続されている。この通信I/F13は、伝送路を通して外部機器の間でデータ通信を行う。
撮像部14は、商品18に貼られたバーコード2を含む領域を撮像し、その多階調、例えば0〜255階調の映像信号を出力するもので、例えばCCD等により成るイメージセンサが用いられる。
The
The communication I /
The
2値化処理部15は、撮像部14の撮像により取得された多階調画像データに対してしきい値th2を用いて2値化して2値化データDbを取得する。この2値化処理部15での2値化処理に用いるしきい値th2は、後述するしきい値可変設定部17により可変設定される。
デコード部16は、2値化処理部15により取得された2値化データDbからバーコード2に含まれる情報を読み取る。
The
The
しきい値可変設定部17は、撮像部14の撮像により取得された多階調画像データDaにおける階調レベルの変動に応じてしきい値th2を可変設定するもので、例えば階調レベルの変動、例えばバーコード2における黒バー部分に対する背景部分の階調レベルの変動に応じて2値化処理部15のしきい値th2を増加又は減少する。
このしきい値可変設定部17は、バーコード2を読み取る方向、すなわち撮像部14によりバーコード2を撮像するときのスキャン方向と同一方向において、多階調画像データDaにおける注目画素の階調レベルとこの注目画素よりも少なくとも1画素前の画素の階調レベルとのレベル差に基づいてしきい値th2を増加又は減少させる。例えば、図2に示すように注目画素iの階調レベルをp(i)とし、この注目画素iに対して1画素前である直前の画素i−1の階調レベルをp(i-1)とすると、しきい値可変設定部17は、1画素前の画素i−1の階調レベルp(i-1)と注目画素iの階調レベルp(i)とのレベル差Δdを算出する。
Δd=p(i-1)−p(i) …(1)
しきい値可変設定部17は、1画素前の画素i−1の階調レベルp(i-1)と注目画素iの階調レベルp(i)とのレベル差Δdを算出した結果、このレベル差Δdが無くゼロ「0」、正値(Δd>0)、又は負値(Δd<0)のいずれであるのかを判定する。すなわち、レベル差Δdが「0」であるのは、1画素前の画素i−1の階調レベルp(i-1)と注目画素iの階調レベルp(i)とのレベル差Δdに変化がないことを示す。レベル差Δdが正値(Δd>0)であるのは、レベル差Δdが増加する方向であることを示す。レベル差Δdが負値(Δd<0)であるのは、レベル差Δdが減少する方向であることを示す。
The threshold variable setting unit 17 variably sets the threshold th2 according to the variation of the gradation level in the multi-gradation image data Da acquired by the imaging of the
The threshold value variable setting unit 17 reads the gradation level of the target pixel in the multi-gradation image data Da in the direction in which the
Δd = p (i−1) −p (i) (1)
As a result of calculating the level difference Δd between the gradation level p (i−1) of the pixel i−1 one pixel before and the gradation level p (i) of the pixel of interest i, the threshold variable setting unit 17 It is determined whether there is no level difference Δd, zero “0”, a positive value (Δd> 0), or a negative value (Δd <0). That is, the level difference Δd is “0” because the level difference Δd between the gradation level p (i−1) of the pixel i−1 one pixel before and the gradation level p (i) of the pixel of interest i. Indicates no change. A positive level difference (Δd> 0) indicates that the level difference Δd is increasing. The level difference Δd being a negative value (Δd <0) indicates that the level difference Δd is decreasing.
しきい値可変設定部17は、レベル差Δdが「0」、正値(Δd>0)、又は負値(Δd<0)のいずれであるのかの判定の結果、レベル差が「0」であれば、2値化処理部15のしきい値th2を変化させずに維持する。
しきい値可変設定部17は、レベル差Δdが正値(Δd>0)であれば、しきい値th2を増加する。例えば、しきい値可変設定部17は、
th2=th2+1 …(2)
を算出して2値化処理部15のしきい値th2を「1」だけ増加する。
しきい値可変設定部17は、レベル差Δdが負値(Δd<0)であれば、しきい値th2を減少する。例えば、しきい値可変設定部17は、
th2=th2−1 …(3)
を算出して2値化処理部15のしきい値th2を「1」だけ減少する。
As a result of determining whether the level difference Δd is “0”, a positive value (Δd> 0), or a negative value (Δd <0), the threshold variable setting unit 17 determines that the level difference is “0”. If there is, the threshold value th2 of the
The threshold variable setting unit 17 increases the threshold th2 if the level difference Δd is a positive value (Δd> 0). For example, the threshold variable setting unit 17
th2 = th2 + 1 (2)
And the threshold value th2 of the
If the level difference Δd is a negative value (Δd <0), the variable threshold setting unit 17 decreases the threshold th2. For example, the threshold variable setting unit 17
th2 = th2-1 (3)
And the threshold value th2 of the
しきい値可変設定部17は、多階調画像データDaにおける注目画素iの階調レベルp(i)と注目画素iよりも例えば直前の1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdが予め設定された境界判定レベル差th3以下であるか否かを判定する。すなわち、しきい値可変設定部17は、注目画素iが例えばバーコード2における黒バー部分中又はこの黒バー部分の背景部分中であるか否かを判断する。換言すれば、注目画素iが直前の1画素前から同一色中すなわち黒バー部分中である黒色中にあるか、又は背景部分の白色中にあるかを判断する。この判断は、バーコード2における黒バー部分中又は背景部分中であれば、多階調画像データDaにおける階調レベルの変動が緩慢であり、これら黒バー部分中又は背景部分中においてしきい値th2の変更設定を行うためである。なお、黒バー部分と背景部分との境界部では、多階調画像データDaにおける階調レベルの変動が急峻であり、しきい値th2の変更設定を行わない。
The threshold variable setting unit 17 sets the gradation level p (i) of the pixel of interest i in the multi-tone image data Da and the gradation level p (1) of the pixel i−1 immediately before the pixel of interest i. It is determined whether or not the level difference Δd from i−1) is equal to or smaller than a preset boundary determination level difference th3. That is, the threshold variable setting unit 17 determines whether or not the target pixel i is, for example, in the black bar portion of the
例えば図3に示すようにバーコード2における例えば黒バー部分から背景部分に移るとき、又は背景部分から黒バー部分に移るとき、多階調画像データDaの階調レベルは、予め設定された境界判定レベル差th3以上変動する。これにより、黒バー部分内又は背景部分内であれば、多階調画像データDaの階調レベルは、予め設定された境界判定レベル差th3内にある。
For example, as shown in FIG. 3, when the
従って、しきい値可変設定部17は、判定の結果、レベル差Δdが予め設定された境界判定レベル差th3以下であれば、黒バー部分内又は背景部分内であると判断し、上記の如くレベル差Δdが「0」、正値、又は負値のいずれかに応じてしきい値th2を変化させない、「1」だけ増加する、又は「1」だけ減少する。 Accordingly, if the level difference Δd is equal to or less than the preset boundary determination level difference th3 as a result of the determination, the threshold value variable setting unit 17 determines that it is within the black bar portion or the background portion, and as described above. Depending on whether the level difference Δd is “0”, a positive value, or a negative value, the threshold th2 is not changed, increased by “1”, or decreased by “1”.
次に、上記の如く構成された装置によるバーコードの読取動作について図4に示す2値化処理の順序を示す図に従って説明する。
例えば商品18がオペレータによって撮像部14の撮像領域内に配置される。このとき、オペレータは、商品18に付けられているバーコード2を撮像部14に向けて配置すると共に、撮像部14のフォーカス位置にバーコード2が配置されるように商品18を撮像部14に対して近付けたり遠ざけたりする。撮像部14は、例えばオペレータによって把持されている商品18に付けられたバーコード2を含む領域を撮像し、その映像信号を出力する。この撮像部14から出力された映像信号は、CPU10の指令により順次RAM12に送られ、最終的にバーコード2の全体を含む多階調画像データDaとして記憶される。
Next, the barcode reading operation by the apparatus configured as described above will be described with reference to the binarization processing sequence shown in FIG.
For example, the
ここで、撮像部14により商品18に付されたバーコード2を撮像する場合、バーコード2に対して照明を行うが、この照明領域の例えば中央部とその周辺部との間には照明ムラが生じる。撮像部14は、撮像面1上の中央部でバーコード2を捉えたときに照明ムラが生じないように撮像領域の方向を設定しているため、撮像部14における撮像面1上の中央部とその周辺部との間に照明ムラが生じる。しかるに、バーコード2がオペレータによって撮像部14における撮像面1上の周辺部に配置されると、バーコード2上に照明ムラが生じる。例えば図5はバーコード2上に照明ムラが生じた場合の多階調画像データDaの階調レベルの変動を示す。撮像部14における撮像面1上の階調レベルは、中央部からその周辺部になるに従って低下している。
Here, when the
しきい値可変設定部17は、ステップ#1において、多階調画像データDa中の2値化対象ラインm、すなわち撮像部14によりバーコード2を撮像するときのスキャン方向と同一方向の2値化対象ラインmに対して2値化のためのしきい値th2を初期設定する。初期設定の方法は、例えば多階調画像データDaの全体あるいは注目しているラインm単位に、平均法、Pタイル法、モード法、又は判別分析法等の方法を用いて求めた値nをしきい値th2として初期設定する。すなわちしきい値th2=nである。
次に、しきい値可変設定部17は、ステップ#2において、注目画素iの初期座標xを設定する。この注目画素iの初期座標xは、例えば図5に示す撮像部14における撮像面1中における2値化対象ラインm上の最左側xに設定される。例えばi=xである。
In
Next, the threshold variable setting unit 17 sets the initial coordinate x of the pixel of interest i in
次に、しきい値可変設定部17は、ステップ#3において、図2に示すように注目画素iの階調レベルp(i)と1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdを上記式(1)を算出して求める。
次に、しきい値可変設定部17は、ステップ#4において、注目画素iが直前の1画素前から同一色中すなわち黒バー部分中である黒色中にあるか、又は背景部分の白色中にあるかを判断するために、多階調画像データDaにおける注目画素iの階調レベルp(i)と注目画素iよりも例えば直前の1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdが予め設定された境界判定レベル差th3以下であるか否かを判定する。例えば図3に示すようにバーコード2における例えば黒バー部分から背景部分に移るとき、又は背景部分から黒バー部分に移るとき、多階調画像データDaの階調レベルは、予め設定された境界判定レベル差th3以上変動する。
Next, in
Next, in
この判定の結果、注目画素iの階調レベルp(i)と注目画素iよりも例えば直前の1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdが予め設定された境界判定レベル差th3以下であれば、しきい値可変設定部17は、バーコード2における黒バー部分中又は背景部分中であると判断し、ステップ#5に移る。なお、バーコード2における黒バー部分中又は背景部分中でなければ、黒バー部分と背景部分との境界であり、多階調画像データDaの階調レベルが予め設定された境界判定レベル差th3以上変動するので、しきい値可変設定部17は、ステップ#9に移る。
As a result of the determination, the level difference Δd between the gradation level p (i) of the pixel of interest i and the gradation level p (i−1) of the pixel i−1 immediately before the pixel i of interest, for example, is previously determined. If it is equal to or smaller than the set boundary determination level difference th3, the threshold value variable setting unit 17 determines that the
次に、しきい値可変設定部17は、バーコード2における黒バー部分中又は背景部分中であると判断すると、ステップ#5において、レベル差Δdが「0」であるか否かを判定する。この判定の結果、レベル差Δdが「0」であれば、しきい値可変設定部17は、しきい値th2を変更せずに維持してステップ#9に移り、2値化処理部15により2値化を行わせる。すなわち、レベル差Δdが「0」であることは、注目画素iの階調レベルp(i)と1画素前の画素i−1の階調レベルp(i-1)とが同一であり、バーコード2に対する注目画素iの照明の照度と1画素前の画素の照明の照度とが同一であることを示す。
Next, when the threshold variable setting unit 17 determines that the black bar portion or the background portion is in the
一方、判定の結果、レベル差Δdが「0」でなければ、しきい値可変設定部17は、ステップ#6に移り、レベル差Δdが負値(Δd<0)であるか否かを判定する。この判定の結果、レベル差Δdが負値(Δd<0)であれば、しきい値可変設定部17は、ステップ#7に移り、上記式(2)を算出して2値化処理部15のしきい値th2を「1」だけ増加する。すなわち、注目画素iの階調レベルp(i)と1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdが負値(Δd<0)であることは、注目画素iの階調レベルp(i)が1画素前の画素i−1の階調レベルp(i-1)よりも高いことであり、バーコード2に対する注目画素iの照明の照度が1画素前の画素の照明の照度よりも高くなっていることを示す。
On the other hand, if the level difference Δd is not “0” as a result of the determination, the threshold value variable setting unit 17 proceeds to Step # 6 and determines whether the level difference Δd is a negative value (Δd <0). To do. As a result of this determination, if the level difference Δd is a negative value (Δd <0), the threshold variable setting unit 17 proceeds to step # 7, calculates the above equation (2), and performs the
一方、レベル差Δdが正値(Δd>0)であれば、しきい値可変設定部17は、ステップ#8に移り、上記式(3)を算出してしきい値th2を「1」だけ減少する。すなわち、注目画素iの階調レベルp(i)と1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdが正値(Δd>0)であることは、注目画素iの階調レベルp(i)が1画素前の画素i−1の階調レベルp(i-1)よりも低いことであり、バーコード2に対する注目画素iの照明の照度が1画素前の画素の照明の照度よりも低くなっていることを示す。
On the other hand, if the level difference Δd is a positive value (Δd> 0), the threshold value variable setting unit 17 proceeds to step # 8, calculates the above equation (3), and sets the threshold value th2 to “1”. Decrease. That is, the level difference Δd between the gradation level p (i) of the pixel of interest i and the gradation level p (i−1) of the pixel i−1 one pixel before is a positive value (Δd> 0) The gradation level p (i) of the pixel of interest i is lower than the gradation level p (i-1) of the pixel i-1 one pixel before, and the illumination intensity of the pixel of interest i with respect to the
この結果、しきい値可変設定部17は、図5に示すように注目画素iの階調レベルp(i)と1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdが負値(Δd>0)であってバーコード2に対する注目画素iの照明の照度が1画素前の画素の照明の照度よりも高くなるに従って2値化処理部15のしきい値th2を「1」ずつ増加する。
これに対してしきい値可変設定部17は、注目画素iの階調レベルp(i)と1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdが正値(Δd<0)であってバーコード2に対する注目画素iの照明の照度が1画素前の画素の照明の照度よりも低くなるに従ってしきい値th2を「1」ずつ減少する。なお、バーコード2に対する注目画素iの照明の照度と1画素前の画素の照明の照度とが同一であれば、しきい値可変設定部17は、2値化処理部15のしきい値th2を変更しない。
As a result, as shown in FIG. 5, the threshold variable setting unit 17 calculates the gradation level p (i) of the pixel of interest i and the gradation level p (i-1) of the pixel i-1 one pixel before. As the level difference Δd is a negative value (Δd> 0) and the illumination intensity of the pixel i of interest with respect to the
On the other hand, the threshold variable setting unit 17 has a positive level difference Δd between the gradation level p (i) of the pixel of interest i and the gradation level p (i-1) of the pixel i-1 one pixel before. The threshold th2 is decreased by “1” as the value (Δd <0) and the illuminance of the illumination of the pixel i of interest with respect to the
次に、2値化処理部15は、ステップ#9において、しきい値可変設定部17によって変更されなかったしきい値th2、増加又は減少されたしきい値th2を用いて撮像部14の撮像により取得された多階調画像データDaに対して2値化処理を行い、この2値化データDbを取得する。
次に、デコード部16は、2値化処理部6により取得された2値化データDbからバーコード2に含まれる情報を読み取る。すなわち、デコード部16は、2値化データDbに対して例えば多方向に走査することによりバーコード2の領域を走査し、この走査により得られる2値化データDbの連側幅を検証してバーコード2のデコードを行う。このバーコード2のデコード結果は、CPU10の指令により通信I/F13を通して例えばPOSシステム等の外部機器に送られる。
Next, in
Next, the
このように上記一実施の形態によれば、例えば商品18に付されたバーコード2を撮像部14により撮像して多階調画像データDaを取得し、この多階調画像データDaに対してしきい値th2を用いて2値化し、この2値化データDbからバーコード2に含まれる商品18の情報を読み取る場合、多階調画像データDaにおける階調レベルの変動に応じてしきい値th2を可変設定し、この可変設定したしきい値th2を用いて多階調画像データDaを2値化する。
これにより、バーコード2が例えばオペレータによって撮像部14における撮像面1上の周辺部に配置されると、バーコード2上に照明ムラが生じるが、この照明ムラが生じても、この照明ムラの照度に応じて適切なしきい値th2に変更することができ、撮像時の環境条件、特に照明の照度ムラの影響を受けずに安定して正確にバーコード2を2値化できる。この結果、2値化により取得された2値化データDbからバーコード2に含まれる情報を正確に読み取ることができる。
As described above, according to the above-described embodiment, for example, the
Thereby, for example, when the
オペレータは、商品18に付けられているバーコード2を撮像部14に向けて配置すると共に、撮像部14のフォーカス位置にバーコード2が配置されるように商品18を撮像部14に対して近付けたり遠ざけたりするが、バーコード2が撮像部14の撮像面1上の中央部に必ず配置されるとは限らない。バーコード2が撮像部14の撮像面1上の周辺部に配置されることも生じる。このような場合でもバーコード2の2値化が不可能になることはない。
The operator places the
なお、本発明は上記実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化できる。また、上記実施形態に開示されている複数の構成要素の適宜な組み合わせにより、種々の発明を形成できる。例えば、実施形態に示される全構成要素から幾つかの構成要素を削除してもよい。さらに、異なる実施形態にわたる構成要素を適宜組み合わせてもよい。
しきい値可変設定部17は、注目画素iの階調レベルp(i)と1画素前の画素i−1の階調レベルp(i-1)とのレベル差Δdを算出しているが、これに限らず、注目画素iとこの注目画素iよりも例えば2画素前等の複数画素前の画素との各階調レベルのレベル差Δdを算出してもよい。
上記一実施の形態では、バーコード2に適用した場合について説明したが、これに限らず、2次元コードとして例えばQRコードを読み取るときのしきい値を変更設定することにも適用可能である。
Note that the present invention is not limited to the above-described embodiment as it is, and can be embodied by modifying the constituent elements without departing from the scope of the invention in the implementation stage. In addition, various inventions can be formed by appropriately combining a plurality of components disclosed in the embodiment. For example, some components may be deleted from all the components shown in the embodiment. Furthermore, constituent elements over different embodiments may be appropriately combined.
The threshold variable setting unit 17 calculates a level difference Δd between the gradation level p (i) of the pixel of interest i and the gradation level p (i−1) of the pixel i−1 one pixel before. However, the present invention is not limited to this, and the level difference Δd of each gradation level between the pixel of interest i and a plurality of pixels before the pixel of interest i, for example, two pixels before, may be calculated.
In the above-described embodiment, the case where the present invention is applied to the
黒バー部分と背景部分との境界部は、注目画素iの直前2画素前から黒バー部分中又は背景部分中にあるかを判断しているが、注目画素iの直前2画素前に限らず、例えば直前3画素以上前の画素から黒バー部分中又は背景部分中にあるかを判断してもよい。 It is determined whether the boundary between the black bar portion and the background portion is in the black bar portion or in the background portion from two pixels before the pixel of interest i, but is not limited to two pixels immediately before the pixel of interest i. For example, it may be determined whether the pixel is in the black bar portion or the background portion from the pixel three pixels or more immediately before.
1:撮像装置の撮像面、2:バーコード、10:CPU101:ROM、12:RAM、13:通信インタフェース(通信I/F)、14:撮像部、15:2値化処理部、16:デコード部、17:しきい値可変設定部、18:商品。 1: imaging surface of imaging device, 2: barcode, 10: CPU 101: ROM, 12: RAM, 13: communication interface (communication I / F), 14: imaging unit, 15: binarization processing unit, 16: decoding Part, 17: Threshold variable setting part, 18: Product.
Claims (6)
前記多階調画像データ中における前記2次元コードを読み取る方向における注目画素の前記階調レベルと前記注目画素よりも前記2次元コードを読み取る方向に少なくとも1画素前の画素の前記階調レベルとの変動のレベル差が予め設定された前記2次元コードにおける黒バー部分とその背景部分との境界を判定するための境界判定レベル差以下であるか否かを判定し、この判定の結果、前記レベル差が前記予め設定された境界判定レベル差以下であれば、前記しきい値を増加又は減少させ、前記レベル差が前記予め設定された境界判定レベル差以下でなければ、前記しきい値の増加又は減少を行わないしきい値可変設定部、
を具備することを特徴とする2次元コード読取装置。 At least a two-dimensional code is imaged by an imaging device to obtain multi-gradation image data, the multi-gradation image data is binarized using a threshold value, and the two-dimensional code is obtained from the binarized data. In a two-dimensional code reader for reading information contained in
The gradation level of the pixel of interest in the direction of reading the two-dimensional code in the multi-gradation image data and the gradation level of a pixel at least one pixel before the pixel of interest in the direction of reading the two-dimensional code. It is determined whether or not the level difference of the fluctuation is equal to or less than a boundary determination level difference for determining the boundary between the black bar portion and the background portion in the preset two-dimensional code. If the difference is less than or equal to the preset boundary determination level difference, the threshold value is increased or decreased. If the difference is not less than or equal to the preset boundary determination level difference, the threshold value is increased. Or a threshold variable setting unit that does not decrease,
A two-dimensional code reading device comprising:
前記多階調画像データ中における前記2次元コードを読み取る方向における注目画素の前記階調レベルと前記注目画素よりも前記2次元コードを読み取る方向に少なくとも1画素前の画素の前記階調レベルとの変動のレベル差が予め設定された前記2次元コードにおける黒バー部分とその背景部分との境界を判定するための境界判定レベル差以下であるか否かを判定し、
この判定の結果、前記レベル差が前記予め設定された境界判定レベル差以下であれば、前記しきい値を増加又は減少させ、
前記レベル差が前記予め設定された境界判定レベル差以下でなければ、前記しきい値の増加又は減少を行わない、
ことを特徴とする2次元コード読取方法。 At least a two-dimensional code is imaged by an imaging device to obtain multi-gradation image data, the multi-gradation image data is binarized using a threshold value, and the two-dimensional code is obtained from the binarized data. In a two-dimensional code reading method for reading information contained in
The gradation level of the pixel of interest in the direction of reading the two-dimensional code in the multi-gradation image data and the gradation level of a pixel at least one pixel before the pixel of interest in the direction of reading the two-dimensional code. It is determined whether or not the level difference of fluctuation is equal to or less than a boundary determination level difference for determining a boundary between the black bar portion and the background portion in the preset two-dimensional code,
As a result of this determination, if the level difference is less than or equal to the preset boundary determination level difference, the threshold value is increased or decreased,
If the level difference is not less than or equal to the preset boundary determination level difference, the threshold value is not increased or decreased.
A two-dimensional code reading method.
前記判定の結果、前記レベル差がゼロであれば、前記しきい値を変化させず、前記レベル差が前記増加する方向であれば、前記しきい値を増加し、前記レベル差が前記減少する方向であれば、前記しきい値を減少させる、
ことを特徴とする請求項5記載の2次元コード読取方法。 When the level difference is equal to or less than the preset boundary determination level difference, the level difference between the gradation level of the target pixel and the gradation level of a pixel at least one pixel before the target pixel is zero. Determine whether the direction is increasing or decreasing.
If the level difference is zero as a result of the determination, the threshold value is not changed, and if the level difference is in the increasing direction, the threshold value is increased and the level difference is decreased. If the direction, decrease the threshold,
The two-dimensional code reading method according to claim 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011089101A JP5264956B2 (en) | 2011-04-13 | 2011-04-13 | Two-dimensional code reading apparatus and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011089101A JP5264956B2 (en) | 2011-04-13 | 2011-04-13 | Two-dimensional code reading apparatus and method |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007198069A Division JP4728297B2 (en) | 2007-07-30 | 2007-07-30 | Two-dimensional code reading apparatus and method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2011159317A true JP2011159317A (en) | 2011-08-18 |
JP5264956B2 JP5264956B2 (en) | 2013-08-14 |
Family
ID=44591154
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011089101A Expired - Fee Related JP5264956B2 (en) | 2011-04-13 | 2011-04-13 | Two-dimensional code reading apparatus and method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5264956B2 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108154209A (en) * | 2016-12-02 | 2018-06-12 | 杭州海康机器人技术有限公司 | A kind of Quick Response Code generation, recognition methods and device for localization for Mobile Robot |
JP2019061527A (en) * | 2017-09-27 | 2019-04-18 | 富士通株式会社 | Data determination device, library device, and data determination program |
CN114143474A (en) * | 2021-12-06 | 2022-03-04 | 广州尚臣电子有限公司 | Object sensing processing method based on image average gray scale |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02141886A (en) * | 1988-11-24 | 1990-05-31 | Eastman Kodatsuku Japan Kk | Binarizing device for bar-code reader |
JP2000259759A (en) * | 1999-03-11 | 2000-09-22 | Nec Corp | Device and method for reading barcode, and storing medium storing program |
JP4728297B2 (en) * | 2007-07-30 | 2011-07-20 | 東芝テック株式会社 | Two-dimensional code reading apparatus and method |
-
2011
- 2011-04-13 JP JP2011089101A patent/JP5264956B2/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02141886A (en) * | 1988-11-24 | 1990-05-31 | Eastman Kodatsuku Japan Kk | Binarizing device for bar-code reader |
JP2000259759A (en) * | 1999-03-11 | 2000-09-22 | Nec Corp | Device and method for reading barcode, and storing medium storing program |
JP4728297B2 (en) * | 2007-07-30 | 2011-07-20 | 東芝テック株式会社 | Two-dimensional code reading apparatus and method |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108154209A (en) * | 2016-12-02 | 2018-06-12 | 杭州海康机器人技术有限公司 | A kind of Quick Response Code generation, recognition methods and device for localization for Mobile Robot |
CN108154209B (en) * | 2016-12-02 | 2021-03-26 | 杭州海康机器人技术有限公司 | Two-dimensional code generation and identification method and device for mobile robot positioning |
JP2019061527A (en) * | 2017-09-27 | 2019-04-18 | 富士通株式会社 | Data determination device, library device, and data determination program |
CN114143474A (en) * | 2021-12-06 | 2022-03-04 | 广州尚臣电子有限公司 | Object sensing processing method based on image average gray scale |
CN114143474B (en) * | 2021-12-06 | 2023-10-10 | 广州尚臣电子有限公司 | Image average gray level-based somatosensory processing method |
Also Published As
Publication number | Publication date |
---|---|
JP5264956B2 (en) | 2013-08-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6945516B2 (en) | Local tone mapping for symbol reading | |
JP5701182B2 (en) | Image processing apparatus, image processing method, and computer program | |
JP2007213359A (en) | Two-dimensional code detection system and two-dimensional code detection program | |
JP5555672B2 (en) | Image processing device | |
KR101224164B1 (en) | Pre- processing method and apparatus for license plate recognition | |
KR101549495B1 (en) | An apparatus for extracting characters and the method thereof | |
CN105321191A (en) | Method and electronic apparatus for processing reflection in image | |
JP5264956B2 (en) | Two-dimensional code reading apparatus and method | |
JP4322230B2 (en) | Surface defect inspection apparatus and surface defect inspection method | |
JP4728297B2 (en) | Two-dimensional code reading apparatus and method | |
JP4749382B2 (en) | Two-dimensional code reading apparatus and method | |
JP2021015489A (en) | Image analysis device, image analysis system, image analysis method and image analysis program | |
JP3906221B2 (en) | Image processing method and image processing apparatus | |
KR101562988B1 (en) | Apparatus and method for detecting surface defects of hot billet | |
JP5427828B2 (en) | Two-dimensional code reading apparatus and method | |
KR101595719B1 (en) | Apparatus for image preprocessing in identification recognizer | |
JP6977425B2 (en) | Image processing equipment, binary image production method and image processing program | |
JP5337844B2 (en) | Region detection apparatus, region detection method, and program | |
JP2008305058A (en) | Code reading device and method | |
JP2023008183A (en) | Imaging apparatus, control method, program, and storage medium | |
JP5282559B2 (en) | Information code reader | |
JP2009295028A (en) | Image processing method and image processing device | |
JP2009124332A (en) | Image processor, image processing method and program | |
JP4230962B2 (en) | Image processing apparatus, image processing method, and image processing program | |
JP2008205603A (en) | Image processing apparatus and image processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20110413 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A132 Effective date: 20121127 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130124 |
|
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: 20130402 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130430 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |