JP2011159317A - Device and method for reading two-dimensional code - Google Patents

Device and method for reading two-dimensional code Download PDF

Info

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
Application number
JP2011089101A
Other languages
Japanese (ja)
Other versions
JP5264956B2 (en
Inventor
Hitoshi Iizaka
仁志 飯坂
Shoya Yamada
祥也 山田
Osamu Tsuchiya
修 土屋
Hidehiro Naito
英浩 内藤
Norihiko Kurihara
規彦 栗原
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.)
Toshiba TEC Corp
Original Assignee
Toshiba TEC Corp
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 Toshiba TEC Corp filed Critical Toshiba TEC Corp
Priority to JP2011089101A priority Critical patent/JP5264956B2/en
Publication of JP2011159317A publication Critical patent/JP2011159317A/en
Application granted granted Critical
Publication of JP5264956B2 publication Critical patent/JP5264956B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To stably and accurately binarize a barcode without being affected by an environmental condition in imaging, particularly, illuminance unevenness of illumination. <P>SOLUTION: It is determined whether a fluctuation level difference between a gradation level of a target pixel in a direction of reading a two-dimensional code in multi-gradation image data with a gradation level of a pixel at least one before this target pixel in the direction of reading the two-dimensional code is a boundary determination level difference for determining a boundary between a black bar portion and a background portion thereof in a preset two-dimensional code or less. When the level difference is the preset boundary determination level difference or less as a result of the determination, a threshold is increased or decreased. When the level difference is not the preset boundary determination level difference or less, the increase or decrease of the threshold is not performed. <P>COPYRIGHT: (C)2011,JPO&INPIT

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, Patent Document 1. In this patent document 1, the threshold level for determining “black” or “white” is not fixed, but the threshold level is set according to the density (whiteness) of the background of the barcode label. Disclose.

特許第2678009号公報(特開平1−252067号公報)Japanese Patent No. 2678009 (Japanese Patent Laid-Open No. 1-252067)

撮像装置により例えば商品に付されたバーコードを撮像するときには、バーコードに対して照明を行うが、この照明領域の例えば中央部では照明ムラが殆どないが、その周辺では、中央部との間に照明ムラが生じる。このような事から例えば撮像装置のフォーカス位置で撮像装置の撮像方向と照明方向とを一致させている。これにより、撮像装置は、バーコードを捉えたときに照明ムラが生じないように照明ムラの殆どない照明領域の中央部に向けて撮像領域の方向が設定される。このように撮像装置の撮像方向と照明方向とを設定しているが、照明領域の例えば中央部とその周辺との間には照明ムラが生じるために、撮像装置における撮像面上の中央部とその周辺部との間に照明ムラが生じる。しかるに、バーコードが例えばオペレータによって撮像装置における撮像面上の中央部に配置されると、バーコード上に照明ムラが生じないが、バーコードが撮像装置における撮像面上の周辺部に配置されると、バーコード上に照明ムラが生じる。   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 barcode 2 is arranged in the peripheral portion on the imaging surface 1 in the imaging apparatus. When the barcode 2 is arranged in the peripheral portion on the imaging surface 1 in the imaging device in this way, illumination unevenness occurs on the barcode 2, so that the gradation level of the multi-value image data on the line m is, for example, It fluctuates and is lower at its peripheral part than at the central part on the imaging surface 1.

このように階調レベルが変動している多値画像データに対して固定設定されたしきい値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 imaging surface 1 is processed. Can reproduce the barcode 2 by binarization processing, but the illuminance decreases as it goes to the periphery on the imaging surface 1, that is, the right side in FIG. The tone level becomes lower than the threshold value th1, and it becomes impossible to reproduce the barcode 2 despite the presence of the barcode 2.

特許文献1は、バーコードラベルの下地の濃度(白色度)に応じてしきい値レベルを設定しており、読み取る対象のバーコードの下地が所定の濃度レベルを有していることを前提とする。特にバーコード読み取り装置に商品をかざして当該商品に付されたバーコードを読み取る場合、バーコードを撮像装置の撮像面上の中央部(装置の正面)で捉えた場合には照明が均一に当たっているため2値化に支障はない。
しかしながら、特許文献1でもバーコードを撮像面上の周辺部で捉えた場合には、周辺部の照度が低下するために、上記同様に、バーコード領域の両端で多階調レベルに差が生じる。すなわち、特許文献1は、バーコードラベルの下地の濃度(白色度)に応じてしきい値レベルを設定しているが、この設定されるしきい値レベルは、撮像装置の撮像により取得されるそれぞれ異なる複数の画像データ毎に可変設定される。すなわち、複数の画像データ毎に設定される各しきい値レベルは、それぞれ図6に示すしきい値th1と同様に、1つの画像データ内で変化しない一定値を示す。このため、特許文献1であっても上記図6に示す説明と同様に、1つの画像データに対して設定されたしきい値レベルは、固定設定されたものと同一になる。従って、特許文献1に開示されているしきい値レベルを用いて2値化処理したとしても、上記同様に、撮像面上の周辺部になるに従って照度が低下するために、バーコードに対応する多値画像データの階調レベルが一定値を示すしきい値よりも低くなり、バーコードが在るにも拘わらずバーコードを再現することが不可能になる。
Patent Document 1 presupposes that a threshold level is set according to the density (whiteness) of the background of the barcode label, and that the background of the barcode to be read has a predetermined density level. To do. In particular, when reading a barcode attached to a product by holding the product over a barcode reader, the illumination is uniformly applied when the barcode is captured at the center of the imaging surface of the imaging device (the front of the device). Therefore, there is no problem in binarization.
However, even in Patent Document 1, when the barcode is captured at the peripheral portion on the imaging surface, since the illuminance at the peripheral portion is reduced, a difference occurs in multi-gradation levels at both ends of the barcode region as described above. . That is, in Patent Document 1, a threshold level is set in accordance with the density (whiteness) of the background of the barcode label, and this set threshold level is acquired by imaging with an imaging device. It is variably set for each of a plurality of different image data. That is, each threshold level set for each of a plurality of image data is a constant value that does not change within one image data, similarly to the threshold th1 shown in FIG. For this reason, even in Patent Document 1, the threshold level set for one image data is the same as that fixedly set as in the description shown in FIG. Therefore, even if binarization processing is performed using the threshold level disclosed in Patent Document 1, as described above, the illuminance decreases toward the peripheral portion on the imaging surface. The gradation level of the multi-value image data becomes lower than a threshold value indicating a constant value, and it becomes impossible to reproduce the barcode despite the presence of the barcode.

本発明の目的は、撮像時の環境条件、特に照明の照度ムラの影響を受けずに安定して正確にバーコードを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.

本発明に係る2次元コード読取装置の一実施の形態を示す構成図。The block diagram which shows one Embodiment of the two-dimensional code reader which concerns on this invention. 同装置におけるしきい値可変設定部によりレベル差を算出するときの画素を示す摸式図。FIG. 5 is a schematic diagram illustrating pixels when a level difference is calculated by a threshold variable setting unit in the same device. 同装置におけるバーコードにおける例えば黒バー部分から背景部分に移るときの多階調画像データの階調レベルの変動を説明するための図。The figure for demonstrating the fluctuation | variation of the gradation level of multi-gradation image data when it transfers to the background part from the black bar part in the barcode in the apparatus, for example. 同装置における2値化処理の順序を示す図。The figure which shows the order of the binarization process in the same apparatus. 同装置における撮像部の撮像により取得されたバーコード上に照明ムラが生じた場合の多階調画像データの階調レベルの変動を示す図。The figure which shows the fluctuation | variation of the gradation level of multi-tone image data when illumination nonuniformity arises on the barcode acquired by imaging of the imaging part in the same apparatus. 従来における撮像装置の撮像面上の周辺部にバーコードが配置された場合の2値化処理を示す図。The figure which shows the binarization process when a barcode is arrange | positioned in the peripheral part on the imaging surface of the conventional imaging device.

以下、本発明の一実施の形態について図面を参照して説明する。
図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 imaging unit 14, and receives a command from the CPU 100. The binarization processing unit 15, the decoding unit 16, and the threshold variable setting unit 17 operate.

ROM11には、例えば電子キャッシュレジスタの業務を実行させるための業務プログラムや2次元コード読取プログラムが予め格納されている。2次元コード読取プログラムは、例えば商品18に付されたバーコード2を撮像部14により撮像して多階調画像データを取得し、この多階調画像データに対してしきい値th2を用いて2値化させ、この2値化データからバーコード2に含まれる商品18の情報を読み取る場合、多階調画像データにおける階調レベルの変動に応じてしきい値th2を可変設定させ、この可変設定させたしきい値th2を用いて多階調画像データを2値化させる。   In the ROM 11, for example, a business program for executing a business of an electronic cash register and a two-dimensional code reading program are stored in advance. The two-dimensional code reading program captures, for example, the barcode 2 attached to the product 18 by the imaging unit 14 to acquire multi-gradation image data, and uses the threshold th2 for the multi-gradation image data. When binarization is performed and the information of the product 18 included in the barcode 2 is read from the binarized data, the threshold th2 is variably set according to the variation of the gradation level in the multi-gradation image data. The multi-tone image data is binarized using the set threshold value th2.

RAM12は、各種データを一時記憶するためのワークエリアが形成され、例えば撮像部14の撮像により取得された多階調画像データDaを当該ワークエリアに一時記憶したり、デコード部16によりデコードされたバーコード2に含む情報等をワークエリアに一時記憶する。
通信I/F13には、図示しない伝送路を通して例えばPOSシステムのサーバ等の外部機器が接続されている。この通信I/F13は、伝送路を通して外部機器の間でデータ通信を行う。
撮像部14は、商品18に貼られたバーコード2を含む領域を撮像し、その多階調、例えば0〜255階調の映像信号を出力するもので、例えばCCD等により成るイメージセンサが用いられる。
The RAM 12 has a work area for temporarily storing various data. For example, the multi-gradation image data Da acquired by the imaging of the imaging unit 14 is temporarily stored in the work area or decoded by the decoding unit 16. Information included in the barcode 2 is temporarily stored in the work area.
The communication I / F 13 is connected to an external device such as a POS system server through a transmission path (not shown). The communication I / F 13 performs data communication between external devices through a transmission path.
The image pickup unit 14 picks up an image of an area including the barcode 2 attached to the product 18 and outputs a video signal of multiple gradations, for example, 0 to 255 gradations. For example, an image sensor composed of a CCD or the like is used. It is done.

2値化処理部15は、撮像部14の撮像により取得された多階調画像データに対してしきい値th2を用いて2値化して2値化データDbを取得する。この2値化処理部15での2値化処理に用いるしきい値th2は、後述するしきい値可変設定部17により可変設定される。
デコード部16は、2値化処理部15により取得された2値化データDbからバーコード2に含まれる情報を読み取る。
The binarization processing unit 15 binarizes the multi-gradation image data acquired by imaging by the imaging unit 14 using the threshold value th2, and acquires binarized data Db. The threshold value th2 used for the binarization processing in the binarization processing unit 15 is variably set by a threshold value variable setting unit 17 described later.
The decoding unit 16 reads information included in the barcode 2 from the binarized data Db acquired by the binarization processing unit 15.

しきい値可変設定部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 imaging unit 14, for example, the variation of the gradation level For example, the threshold value th <b> 2 of the binarization processing unit 15 is increased or decreased according to the change in the gradation level of the background portion with respect to the black bar portion in the barcode 2.
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 barcode 2 is read, that is, in the same direction as the scanning direction when the imaging unit 14 captures the barcode 2. And the threshold th2 is increased or decreased based on the level difference between the gradation level of the pixel at least one pixel before the target pixel. For example, as shown in FIG. 2, the gradation level of the pixel of interest i is p (i), and the gradation level of the pixel i−1 immediately before the pixel of interest i is p (i−1). ), The threshold variable setting unit 17 calculates 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. To do.
Δ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 binarization processing unit 15 is maintained without being changed.
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 binarization processing unit 15 is increased by “1”.
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 binarization processing unit 15 is decreased by “1”.

しきい値可変設定部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 barcode 2 or in the background portion of the black bar portion. In other words, it is determined whether the target pixel i is in the same color, that is, black in the black bar portion, or white in the background portion from the immediately preceding pixel. In this determination, if the barcode 2 is in the black bar portion or the background portion, the gradation level fluctuation in the multi-tone image data Da is slow, and the threshold value in the black bar portion or the background portion is slow. This is for changing the setting of th2. Note that, at the boundary portion between the black bar portion and the background portion, the gradation level in the multi-gradation image data Da changes steeply, and the threshold value th2 is not changed.

例えば図3に示すようにバーコード2における例えば黒バー部分から背景部分に移るとき、又は背景部分から黒バー部分に移るとき、多階調画像データDaの階調レベルは、予め設定された境界判定レベル差th3以上変動する。これにより、黒バー部分内又は背景部分内であれば、多階調画像データDaの階調レベルは、予め設定された境界判定レベル差th3内にある。   For example, as shown in FIG. 3, when the barcode 2 moves from the black bar portion to the background portion or from the background portion to the black bar portion, the gradation level of the multi-tone image data Da is set to a preset boundary. It fluctuates more than the judgment level difference th3. Thereby, if it is in the black bar portion or the background portion, the gradation level of the multi-tone image data Da is within the preset boundary determination level difference th3.

従って、しきい値可変設定部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 product 18 is placed in the imaging area of the imaging unit 14 by the operator. At this time, the operator places the barcode 2 attached to the product 18 toward the imaging unit 14 and places the product 18 on the imaging unit 14 so that the barcode 2 is arranged at the focus position of the imaging unit 14. Move closer to or away from it. For example, the imaging unit 14 images a region including the barcode 2 attached to the product 18 held by an operator and outputs the video signal. The video signal output from the imaging unit 14 is sequentially sent to the RAM 12 in accordance with a command from the CPU 10 and finally stored as multi-gradation image data Da including the entire barcode 2.

ここで、撮像部14により商品18に付されたバーコード2を撮像する場合、バーコード2に対して照明を行うが、この照明領域の例えば中央部とその周辺部との間には照明ムラが生じる。撮像部14は、撮像面1上の中央部でバーコード2を捉えたときに照明ムラが生じないように撮像領域の方向を設定しているため、撮像部14における撮像面1上の中央部とその周辺部との間に照明ムラが生じる。しかるに、バーコード2がオペレータによって撮像部14における撮像面1上の周辺部に配置されると、バーコード2上に照明ムラが生じる。例えば図5はバーコード2上に照明ムラが生じた場合の多階調画像データDaの階調レベルの変動を示す。撮像部14における撮像面1上の階調レベルは、中央部からその周辺部になるに従って低下している。   Here, when the barcode 2 attached to the product 18 is imaged by the imaging unit 14, the barcode 2 is illuminated. For example, uneven illumination is provided between the central portion and the peripheral portion of the illumination area. Occurs. Since the imaging unit 14 sets the direction of the imaging region so that illumination unevenness does not occur when the barcode 2 is captured at the central part on the imaging surface 1, the central part on the imaging surface 1 in the imaging unit 14 is set. Illumination unevenness occurs between the peripheral portion and the periphery thereof. However, when the bar code 2 is arranged in the peripheral part on the imaging surface 1 in the imaging unit 14 by the operator, illumination unevenness occurs on the bar code 2. For example, FIG. 5 shows a change in the gradation level of the multi-tone image data Da when illumination unevenness occurs on the barcode 2. The gradation level on the imaging surface 1 in the imaging unit 14 decreases from the central part toward the peripheral part.

しきい値可変設定部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 step # 1, the threshold variable setting unit 17 performs binarization in the same direction as the binarization target line m in the multi-tone image data Da, that is, the scan direction when the imaging unit 14 captures the barcode 2. A threshold value th2 for binarization is initialized for the conversion target line m. As an initial setting method, for example, a value n obtained by using an average method, a P-tile method, a mode method, a discriminant analysis method, or the like is applied to the entire multi-gradation image data Da or a line m unit of interest. Initially set as the threshold value th2. That is, the threshold value th2 = n.
Next, the threshold variable setting unit 17 sets the initial coordinate x of the pixel of interest i in step # 2. For example, the initial coordinate x of the pixel of interest i is set to the leftmost x on the binarization target line m in the imaging surface 1 of the imaging unit 14 shown in FIG. For example, i = x.

次に、しきい値可変設定部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 step # 3, the threshold value variable setting unit 17 sets the gradation level p (i) of the pixel of interest i and the gradation level p (i of the pixel i-1 one pixel before as shown in FIG. -1) is obtained by calculating the above equation (1).
Next, in step # 4, the threshold variable setting unit 17 determines that the target pixel i is in the same color, that is, black in the black bar from the previous pixel, or in the white background. In order to determine whether or not there is, the gradation level p (i) of the pixel of interest i in the multi-gradation image data Da and the gradation level p (i of the pixel i−1 immediately before the pixel of interest i, for example, immediately before the pixel of interest i. -1) is determined whether or not the level difference Δd is equal to or less than a preset boundary determination level difference th3. For example, as shown in FIG. 3, when the barcode 2 moves from the black bar portion to the background portion or from the background portion to the black bar portion, the gradation level of the multi-tone image data Da is set to a preset boundary. It fluctuates more than the judgment level difference th3.

この判定の結果、注目画素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 bar code 2 is in the black bar portion or the background portion, and proceeds to step # 5. If it is not in the black bar portion or the background portion in the barcode 2, it is the boundary between the black bar portion and the background portion, and the boundary determination level difference th3 in which the gradation level of the multi-tone image data Da is set in advance. As described above, the threshold variable setting unit 17 proceeds to step # 9.

次に、しきい値可変設定部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 barcode 2, it determines whether or not the level difference Δd is “0” in step # 5. . If the level difference Δd is “0” as a result of this determination, the threshold value variable setting unit 17 maintains the threshold value th2 without changing it, proceeds to step # 9, and the binarization processing unit 15 Make binarization. That is, the level difference Δd being “0” means that the gradation level p (i) of the pixel of interest i is the same as the gradation level p (i−1) of the pixel i−1 one pixel before, This indicates that the illumination intensity of the pixel i of interest with respect to the barcode 2 is the same as the illumination intensity of the previous pixel.

一方、判定の結果、レベル差Δ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 binarization processing unit 15 Is increased by "1". 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 negative value (Δd <0). The gradation level p (i) of the pixel of interest i is higher 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 barcode 2 is 1. It shows that it is higher than the illuminance of the illumination of the pixel before the pixel.

一方、レベル差Δ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 barcode 2 is 1. It shows that it is lower than the illuminance of the illumination of the pixel before the pixel.

この結果、しきい値可変設定部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 barcode 2 becomes higher than the illumination intensity of the illumination of the previous pixel, the threshold value of the binarization processing unit 15 Th2 is increased by “1”.
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 barcode 2 becomes lower than the illuminance of the illumination of the pixel one pixel before. If the illuminance of the illumination of the pixel i of interest with respect to the barcode 2 is the same as the illuminance of the illumination of the pixel one pixel before, the threshold variable setting unit 17 sets the threshold th2 of the binarization processing unit 15. Do not change.

次に、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 step # 9, the binarization processing unit 15 uses the threshold th2 that has not been changed by the threshold variable setting unit 17 and the threshold th2 that has been increased or decreased. The binarization processing is performed on the multi-gradation image data Da acquired by the above, and the binarized data Db is acquired.
Next, the decoding unit 16 reads information included in the barcode 2 from the binarized data Db acquired by the binarization processing unit 6. That is, the decoding unit 16 scans the area of the barcode 2 by scanning the binarized data Db in multiple directions, for example, and verifies the continuous side width of the binarized data Db obtained by this scanning. Barcode 2 is decoded. The decoding result of the barcode 2 is sent to an external device such as a POS system through the communication I / F 13 according to a command from the CPU 10.

このように上記一実施の形態によれば、例えば商品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 barcode 2 attached to the product 18 is captured by the imaging unit 14 to obtain the multi-gradation image data Da, and the multi-gradation image data Da is obtained. When binarization is performed using the threshold value th2, and the information of the product 18 included in the barcode 2 is read from the binarized data Db, the threshold value is determined according to the variation of the gradation level in the multi-gradation image data Da. Th2 is variably set, and the multi-tone image data Da is binarized using the variably set threshold value th2.
Thereby, for example, when the barcode 2 is arranged in the peripheral portion on the imaging surface 1 in the imaging unit 14 by an operator, illumination unevenness occurs on the barcode 2, but even if this illumination unevenness occurs, The threshold value can be changed to an appropriate threshold value th2 according to the illuminance, and the barcode 2 can be binarized stably and accurately without being affected by the environmental conditions at the time of imaging, particularly the illuminance unevenness of illumination. As a result, the information included in the barcode 2 can be accurately read from the binarized data Db acquired by binarization.

オペレータは、商品18に付けられているバーコード2を撮像部14に向けて配置すると共に、撮像部14のフォーカス位置にバーコード2が配置されるように商品18を撮像部14に対して近付けたり遠ざけたりするが、バーコード2が撮像部14の撮像面1上の中央部に必ず配置されるとは限らない。バーコード2が撮像部14の撮像面1上の周辺部に配置されることも生じる。このような場合でもバーコード2の2値化が不可能になることはない。   The operator places the barcode 2 attached to the product 18 toward the imaging unit 14 and brings the product 18 close to the imaging unit 14 so that the barcode 2 is arranged at the focus position of the imaging unit 14. The barcode 2 is not always arranged at the center of the image pickup surface 1 of the image pickup unit 14. It also occurs that the barcode 2 is arranged in the peripheral portion on the imaging surface 1 of the imaging unit 14. Even in such a case, the binarization of the barcode 2 is not impossible.

なお、本発明は上記実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化できる。また、上記実施形態に開示されている複数の構成要素の適宜な組み合わせにより、種々の発明を形成できる。例えば、実施形態に示される全構成要素から幾つかの構成要素を削除してもよい。さらに、異なる実施形態にわたる構成要素を適宜組み合わせてもよい。
しきい値可変設定部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 barcode 2 has been described. However, the present invention is not limited to this, and the present invention can also be applied to changing and setting a threshold value when, for example, reading a QR code as a two-dimensional code.

黒バー部分と背景部分との境界部は、注目画素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値化し、この2値化データから前記2次元コードに含まれる情報を読み取る2次元コード読取装置において、
前記多階調画像データ中における前記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:
前記しきい値可変設定部は、前記レベル差が前記予め設定された境界判定レベル差以下のとき、前記注目画素の前記階調レベルと前記注目画素よりも少なくとも1画素前の画素の前記階調レベルとの前記レベル差に基づいて前記しきい値を増加又は減少させることを特徴とする請求項1記載の2次元コード読取装置。   The threshold variable setting unit, when the level difference is equal to or less than the preset boundary determination level difference, the gradation level of the target pixel and the gradation of the pixel at least one pixel before the target pixel. 2. The two-dimensional code reading device according to claim 1, wherein the threshold value is increased or decreased based on the level difference from the level. 前記しきい値可変設定部は、前記レベル差が前記予め設定された境界判定レベル差以下のとき、前記注目画素の前記階調レベルと前記注目画素よりも少なくとも1画素前の画素の前記階調レベルとの間のレベル変化がゼロ、増加する方向、又は減少する方向のいずれであるのかを判定し、この判定の結果、前記レベル差が前記ゼロであれば、前記しきい値を変化させず、前記レベル差が前記増加する方向であれば、前記しきい値を増加し、前記レベル差が前記減少する方向であれば、前記しきい値を減少させることを特徴とする請求項2記載の2次元コード読取装置。   The threshold variable setting unit, when the level difference is equal to or less than the preset boundary determination level difference, the gradation level of the target pixel and the gradation of the pixel at least one pixel before the target pixel. It is determined whether the level change between levels is zero, increasing, or decreasing. If the level difference is zero as a result of this determination, the threshold is not changed. 3. The threshold value is increased if the level difference is in the increasing direction, and the threshold value is decreased if the level difference is in the decreasing direction. Two-dimensional code reader. 少なくとも2次元コードを撮像装置により撮像して多階調の画像データを取得し、この多階調画像データに対してしきい値を用いて2値化し、この2値化データから前記2次元コードに含まれる情報を読み取る2次元コード読取方法において、
前記多階調画像データ中における前記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.
前記レベル差が前記予め設定された境界判定レベル差以下のとき、前記注目画素の前記階調レベルと前記注目画素よりも少なくとも1画素前の画素の前記階調レベルとの前記レベル差に基づいて前記しきい値を増加又は減少させることを特徴とする請求項4記載の2次元コード読取方法。   When the level difference is equal to or less than the preset boundary determination level difference, based on 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 5. The two-dimensional code reading method according to claim 4, wherein the threshold value is increased or decreased. 前記レベル差が前記予め設定された境界判定レベル差以下のとき、前記注目画素の前記階調レベルと前記注目画素よりも少なくとも1画素前の画素の前記階調レベルとの間のレベル差がゼロ、増加する方向、又は減少する方向のいずれであるのかを判定し、
前記判定の結果、前記レベル差がゼロであれば、前記しきい値を変化させず、前記レベル差が前記増加する方向であれば、前記しきい値を増加し、前記レベル差が前記減少する方向であれば、前記しきい値を減少させる、
ことを特徴とする請求項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.
JP2011089101A 2011-04-13 2011-04-13 Two-dimensional code reading apparatus and method Expired - Fee Related JP5264956B2 (en)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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