JP2000276553A - Method for binarizing information code, optical information reader using this binarizing method, and code quality judging auxiliary equipment using this binarizing method - Google Patents

Method for binarizing information code, optical information reader using this binarizing method, and code quality judging auxiliary equipment using this binarizing method

Info

Publication number
JP2000276553A
JP2000276553A JP11081826A JP8182699A JP2000276553A JP 2000276553 A JP2000276553 A JP 2000276553A JP 11081826 A JP11081826 A JP 11081826A JP 8182699 A JP8182699 A JP 8182699A JP 2000276553 A JP2000276553 A JP 2000276553A
Authority
JP
Japan
Prior art keywords
value
gradation
pixels
gradation value
average
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
JP11081826A
Other languages
Japanese (ja)
Other versions
JP3994571B2 (en
Inventor
Toshiji Ishibashi
利治 石橋
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.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP08182699A priority Critical patent/JP3994571B2/en
Publication of JP2000276553A publication Critical patent/JP2000276553A/en
Application granted granted Critical
Publication of JP3994571B2 publication Critical patent/JP3994571B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To make appropriately binarizable multivalued data without depending on the area ratio of an information code area in fetched image data to a background area. SOLUTION: First, a reference value is calculated (S100 to S120), the average gradation value (dark side average value) of 'dark' side pixels is calculated (S150) by designating gradation values being equal to or less than the reference value (S130) and executing designated range average value calculation processing (S140), the average gradation value (light side average value) of 'light' side pixels is also calculated (S180) by designating gradation values being equal to or more than the reference value (S160) and executing designated range average value calculation processing (S170), and a threshold is decided (S210) by repeating processing that makes the arithmetic mean a new boundary value (reference value) (S220).

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、バーコード、2次
元コード等の情報コードを光学的に読み取る技術に関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a technology for optically reading information codes such as bar codes and two-dimensional codes.

【0002】[0002]

【従来の技術】従来より、情報コードを読み取る装置が
知られている。例えば、従来の2次元コード読取装置の
中には、CCDセンサなどで読み取られて出力されるア
ナログ信号をA/D変換することによって、その信号レ
ベルに応じた多値データ(多階調ディジタル画像デー
タ)として画像メモリに一旦記憶し、この画像メモリに
記憶された多値データを2値データ(2階調ディジタル
画像データ)に変換(以下「2値化」という。)してデ
コードするものがあった。
2. Description of the Related Art Conventionally, an apparatus for reading an information code has been known. For example, in a conventional two-dimensional code reader, an analog signal read and output by a CCD sensor or the like is subjected to A / D conversion to obtain multi-value data (multi-tone digital image data) corresponding to the signal level. Data is stored once in an image memory, and the multi-valued data stored in the image memory is converted into binary data (binary digital image data) (hereinafter referred to as "binarization") and decoded. there were.

【0003】それは、2次元コードにも様々な種類・サ
イズのものがあり、特に高密度の2次元コードを読み取
る場合には、2次元コードを構成する情報単位としての
セル1つあたりの画素数(割り当て画素)が少なくな
り、明(白)/暗(黒)の境界部分に該当する画素を
「明」と判断するか「暗」と判断するかが読み取りの成
否に大きく影響するからである。
There are various types and sizes of two-dimensional codes. Particularly, when reading a high-density two-dimensional code, the number of pixels per cell as an information unit constituting the two-dimensional code is considered. This is because the number of (assigned pixels) decreases, and whether a pixel corresponding to a boundary portion of light (white) / dark (black) is determined as “bright” or “dark” greatly affects the success or failure of reading. .

【0004】多値データを2値化する手法として、AI
Mの作成した国際規格によれば、全てのイメージピクセ
ル値を反射率によってソートし、ピクセルの最も暗い部
分10%が含まれる反射率と最も明るい部分10%が含
まれる反射率との平均を閾値として2値化を行い、これ
によって作成された2値化イメージを使用してコードの
品質判断等を行うこととしている。
[0004] As a method of binarizing multi-value data, AI is used.
According to the international standard created by M, all image pixel values are sorted by reflectivity and the average of the reflectivity containing the darkest 10% and the lightest 10% of the pixels is thresholded. , And the quality of the code is determined using the binarized image created by the binarization.

【0005】ここでこの2値化手法を具体的に説明す
る。まず、各画素が0〜255までの範囲の階調値を有
するような多値データであれば、この階調値によってソ
ートし、全体の10%の画素であって、暗い(階調値が
小さい)側の画素を含む階調値の範囲を求める。この範
囲は、階調値「0」〜「α」と示される。同様に、全体
の10%の画素であって、明るい(階調値が大きい)側
の画素を含む階調値の範囲を求める。この範囲は、階調
値「β」〜「255」として示される。このとき、閾値
を(α+β)/2として求めるという具合である。
Here, this binarization method will be described in detail. First, if it is multi-valued data in which each pixel has a gradation value in the range of 0 to 255, the pixels are sorted by this gradation value, and 10% of the pixels are dark (the gradation value is dark). A range of the gradation value including the pixel on the (small) side is obtained. This range is indicated by gradation values “0” to “α”. Similarly, a range of gradation values that is 10% of the pixels and includes pixels on the brighter side (larger gradation values) is obtained. This range is indicated as gradation values “β” to “255”. At this time, the threshold is obtained as (α + β) / 2.

【0006】例えば図10(a)のような視野で読み取
られた2次元コード画像について、さらに具体的に説明
する。図10(a)中の斜線を施した領域が2次元コー
ド領域を示しており、この2次元コード領域は、明又は
暗のセルによって構成されているものとする。このと
き、図11(a)に、階調値と画素の個数との対応を示
す分布を模式的に示した。このように、階調値と画素の
個数との分布は、2つに分かれるのが一般的である。す
なわち、「暗」に相当する画素の分布が階調値の低い側
に現れ、「明」に相当する画素の分布が階調値の高い側
に現れる。この場合、図11(a)に示すように、暗い
側の10%の画素は階調値α1までに含まれており、一
方、明るい側の10%の画素は階調値β1以上の部分に
含まれている。そのため、閾値γ1は、(α1+β1)
/2として求められる。そして、この閾値γ1にて多値
データ画像を2値化すれば、閾値γ1よりも階調値が小
さい画素は「暗」として、逆にγ1よりも階調値が大き
い画素は「明」として2値化されることになる。これに
よって、「暗」に相当する画素の分布は閾値γ1よりも
階調値の低い方に分布しているため「暗」として、一
方、「明」に相当する画素の分布は閾値γ1よりも階調
値の高い方に分布しているため「明」として2値化され
る。
For example, a two-dimensional code image read in a visual field as shown in FIG. The shaded area in FIG. 10A indicates a two-dimensional code area, and this two-dimensional code area is assumed to be composed of light or dark cells. In this case, FIG. 11A schematically shows a distribution indicating the correspondence between the gradation value and the number of pixels. As described above, the distribution of the gradation value and the number of pixels is generally divided into two. That is, the distribution of the pixels corresponding to “dark” appears on the lower gradation value side, and the distribution of the pixels corresponding to “bright” appears on the higher gradation value side. In this case, as shown in FIG. 11A, 10% of the pixels on the dark side are included up to the gradation value α1, and 10% of the pixels on the light side are included in the portion having the gradation value β1 or more. include. Therefore, the threshold value γ1 is (α1 + β1)
/ 2. If the multi-valued data image is binarized using the threshold value γ1, pixels having a tone value smaller than the threshold value γ1 are regarded as “dark”, and conversely, pixels having a tone value greater than γ1 are regarded as “bright”. It will be binarized. As a result, the distribution of pixels corresponding to “dark” is distributed in a lower gradation value than the threshold value γ1, so that the distribution of pixels corresponding to “bright” is higher than the threshold value γ1. Since it is distributed in the higher gradation value, it is binarized as “bright”.

【0007】[0007]

【発明が解決しようとする課題】しかしながら、この手
法を用いた場合、例えば図10(b)に示すように、画
像データ全体の中で2次元コード領域の占める割合が小
さくなると、すなわち画像データ中の背景領域の面積が
大きくなると、次に示すような不都合が生じる。なお、
2次元コード領域を構成するセルについては図10
(a)と同様とし、背景領域は「明」(白)であるとす
る。
However, in the case where this technique is used, for example, as shown in FIG. 10B, when the proportion of the two-dimensional code area in the whole image data becomes small, When the area of the background region increases, the following inconvenience occurs. In addition,
FIG. 10 shows the cells constituting the two-dimensional code area.
It is assumed that the background area is “bright” (white) as in (a).

【0008】このとき、図11(b)に、階調値と画素
の個数との対応を示す分布を模式的に示した。図11
(b)から分かるように、画像データ中に「暗」に相当
する画素が極端に少なくなるため、「暗」に相当する画
素の個数が減少し、「明」に相当する画素の個数が増加
している。したがって、図11(b)に示すように、暗
い側の10%の画素は階調値α2までに含まれることに
なる。つまり、上述した階調値α1よりも大きくなるの
である。一方、明るい側の10%の画素は階調値β2以
上の部分に含まれている。そのため、閾値γ2は、(α
2+β2)/2として求められるが、この閾値γ2は、
図11(a)に示した閾値γ1と比べて大きくなる。そ
して、この閾値γ2にて多値データ画像を2値化すれ
ば、閾値γ2よりも階調値が小さい画素は「暗」として
2値化されることになる。そのため、図11(a)中に
記号Aで示したような「明」に相当するはずの画素が
「暗」として2値化されしまう。結果として、図10
(b)の場合、2次元コードを構成する各セルの明/暗
の境界部分に該当する画素が「暗」となる可能性が高
く、2値データを画像として復元すると、各セルが「黒
太り」することになり、読み取りに悪影響を与えること
になってしまう。また、この2値データに基づく画像に
よって2次元コードの品質判定を行う場合、図10
(a)と同一の2次元コードを読み取らせた場合でも、
図10(a)のものよりも品質が悪いと判断されてしま
う。
At this time, FIG. 11B schematically shows a distribution indicating the correspondence between the gradation value and the number of pixels. FIG.
As can be seen from (b), the number of pixels corresponding to “dark” decreases and the number of pixels corresponding to “bright” increases because the number of pixels corresponding to “dark” in the image data is extremely small. are doing. Therefore, as shown in FIG. 11B, 10% of the pixels on the dark side are included up to the gradation value α2. That is, it is larger than the above-mentioned gradation value α1. On the other hand, 10% of the pixels on the bright side are included in the portion having the tone value β2 or more. Therefore, the threshold γ2 is (α
2 + β2) / 2, and the threshold γ2 is
It becomes larger than the threshold value γ1 shown in FIG. Then, if the multi-valued data image is binarized using the threshold value γ2, a pixel having a gradation value smaller than the threshold value γ2 is binarized as “dark”. Therefore, a pixel that should correspond to “bright” as indicated by the symbol A in FIG. 11A is binarized as “dark”. As a result, FIG.
In the case of (b), there is a high possibility that a pixel corresponding to a light / dark boundary portion of each cell constituting the two-dimensional code becomes “dark”, and when the binary data is restored as an image, each cell becomes “black”. The result is "fat", which adversely affects reading. When the quality of a two-dimensional code is determined using an image based on the binary data, FIG.
Even when the same two-dimensional code as in (a) is read,
It is determined that the quality is lower than that of FIG.

【0009】この問題を解決するための手法として、例
えば図11(b)中の「暗」に相当する画素の分布の最
頻値α3と、「明」に相当する画素の分布の最頻値β3
との平均(α3+β3)/2を閾値γ3とするという手
法が考えられるが、例えば背景画像領域と比べて2次元
コード画像領域の面積が極端に小さくなったとき等、
「暗」に相当する画素の個数が少なくなったり、また、
「暗」に相当する画素の有する階調値がばらついたりす
ると、最頻値α3が求められない状況も起こり得る。
As a method for solving this problem, for example, the mode α3 of the distribution of pixels corresponding to “dark” and the mode of distribution of pixels corresponding to “bright” in FIG. β3
(Α3 + β3) / 2 is set as the threshold γ3. For example, when the area of the two-dimensional code image area becomes extremely small as compared with the background image area, for example,
The number of pixels corresponding to "dark" decreases,
If the gradation value of the pixel corresponding to “dark” varies, a situation may occur in which the mode α3 cannot be obtained.

【0010】本発明は、取り込んだ画像データ中の情報
コード領域と背景領域との面積比によらず、適切に多値
データを2値化することを目的とする。
An object of the present invention is to appropriately binarize multi-valued data regardless of the area ratio between an information code area and a background area in captured image data.

【0011】[0011]

【課題を解決するための手段及び発明の効果】上記目的
を達成するためになされた請求項1に記載の情報コード
の2値化方法では、読取対象の画像を光学的に検出す
る。例えばCCDセンサを用いて読取対象からの反射光
を電気的な信号に変換する。そして、検出された画像に
対応するアナログ画像信号をA/D変換することによっ
て、読取対象の画像を、各画素が信号レベルに応じた階
調値を有する多値データとして記憶する。例えば各画素
が8ビットの階調値を有する多値データとして記憶する
という具合である。この場合、28 (=256)階調で
あるから、各画素は「0」〜「255」までの階調値を
有することになる。
According to a first aspect of the present invention, there is provided an information code binarizing method, wherein an image to be read is optically detected. For example, the reflected light from the object to be read is converted into an electric signal using a CCD sensor. Then, by subjecting the analog image signal corresponding to the detected image to A / D conversion, the image to be read is stored as multi-value data in which each pixel has a gradation value corresponding to the signal level. For example, each pixel is stored as multi-value data having an 8-bit gradation value. In this case, since there are 2 8 (= 256) gradations, each pixel has a gradation value from “0” to “255”.

【0012】そして、閾値決定処理にて決定される閾値
を用いて、記憶された多値データを2値データに変換す
る。つまり、多階調の各画素を「明」又は「暗」の2階
調に変換するのである。本発明では、このような基本手
順によって、情報コードの2値化が行われるのである
が、本発明の2値化方法においては、上述の閾値決定処
理に特徴を有している。そこで閾値決定処理について以
下説明する。
Then, the stored multi-value data is converted into binary data using the threshold value determined in the threshold value determination process. That is, each pixel of multi-gradation is converted into two gradations of “bright” or “dark”. In the present invention, the information code is binarized by such a basic procedure. The binarization method of the present invention is characterized by the above-described threshold value determination processing. Therefore, the threshold value determination processing will be described below.

【0013】本発明における閾値決定処理は、指定範囲
平均値算出処理を含んでいるため、最初に、この指定範
囲平均値算出処理を説明する。指定範囲平均値算出処理
は、下方階調値と、上方階調値とを求め、その両方の階
調値の相加平均を求める処理である。
Since the threshold value determination processing in the present invention includes the specified range average value calculation processing, the specified range average value calculation processing will be described first. The designated range average value calculation process is a process of calculating a lower gradation value and an upper gradation value, and calculating an arithmetic average of both gradation values.

【0014】下方階調値とは、指定された範囲の階調値
を有する画素の中の所定割合の画素であって、相対的に
小さな階調値を有する画素の有する階調値の最大のもの
をいう。同様に、上方階調値とは、指定された範囲の階
調値を有する画素の中の所定割合の画素であって、相対
的に大きな階調値を有する画素の有する階調値の最小の
ものをいう。
The lower gradation value is a predetermined percentage of the pixels having the gradation value in the designated range, and is the largest of the gradation values of the pixels having the relatively small gradation value. A thing. Similarly, the upper gradation value is a predetermined percentage of the pixels having the gradation value in the specified range, and is the minimum gradation value of the pixel having the relatively large gradation value. A thing.

【0015】例えば、図11に示した例で、階調値
「0」〜「255」を指定し、所定割合を10%とし
て、指定範囲平均値算出処理を実行することを考える。
このとき、全画素の10%の画素であって、相対的に小
さな階調値を有する画素は、図11(a)では階調値
「0」〜「α1」の中に、また、図11(b)では
「0」〜「α2」の中に存在する。したがって、それら
画素の有する最大の階調値は、図11(a)では「α
1」であり、図11(b)では「α2」である。同様
に、全画素の10%の画素であって、相対的に大きな階
調値を有する画素は、図11(a)では階調値「β1」
〜「255」の中に、また、図11(b)では「β2」
〜「255」の中に存在する。したがって、それら画素
の有する最小の階調値は、図11(a)では「β1」で
あり、図11(b)では「β2」である。したがって、
指定範囲平均値算出処理を実行すると、図11(a)に
示した例では、相加平均が階調値γ1として算出され、
図11(b)に示した例では相加平均が階調値γ2とし
て算出されることになる。
For example, in the example shown in FIG. 11, it is assumed that the gradation values "0" to "255" are designated and the predetermined ratio is set to 10% to execute the designated range average value calculation processing.
At this time, pixels that are 10% of all pixels and have relatively small gradation values are included in gradation values “0” to “α1” in FIG. In (b), it exists in “0” to “α2”. Therefore, the maximum gradation value of these pixels is “α” in FIG.
1 ”and“ α2 ”in FIG. 11B. Similarly, a pixel having a relatively large gradation value, which is 10% of all pixels, has a gradation value “β1” in FIG.
11 to “255”, and “β2” in FIG.
~ 255. Therefore, the minimum gradation value of these pixels is “β1” in FIG. 11A, and is “β2” in FIG. 11B. Therefore,
When the designated range average value calculation processing is executed, in the example shown in FIG. 11A, the arithmetic mean is calculated as the gradation value γ1, and
In the example shown in FIG. 11B, the arithmetic mean is calculated as the gradation value γ2.

【0016】このような指定範囲平均値算出処理を含む
閾値決定処理は、次に示す手順(1)〜(5)によって
実行される。手順(1)〜(5)を図4を参照して具体
的に説明し、画像データ中の情報コード領域が背景領域
と比べて極端に小さくなった場合であっても適切に閾値
が設定されることを説明する。なお、図4は、図11
(b)と同様の分布になっている。
The threshold value determination processing including the specified range average value calculation processing is executed by the following procedures (1) to (5). Steps (1) to (5) will be described in detail with reference to FIG. 4. Even when the information code area in the image data is extremely smaller than the background area, the threshold is set appropriately. Explain that Note that FIG.
The distribution is similar to that of FIG.

【0017】まず手順(1)では、全範囲の階調値
「0」〜「255」が指定され、指定範囲平均値算出処
理にて算出される相加平均が基準値とされる。この場
合、図4(a)に示すように、下方階調値α、上方階調
値βが算出され、相加平均γが基準値とされる。
First, in step (1), the gradation values "0" to "255" of the entire range are designated, and the arithmetic mean calculated in the designated range average value calculation processing is used as the reference value. In this case, as shown in FIG. 4A, a lower gradation value α and an upper gradation value β are calculated, and the arithmetic mean γ is used as a reference value.

【0018】続く手順(2)では、基準値γ以下の階調
値が指定され、すなわち階調値「0」〜「γ」が指定さ
れ、範囲平均値算出処理が実行される。この場合、図4
(b)に示すように、下方階調値a1及び上方階調値b
1が算出され、相加平均c1が算出される。そして、相
加平均c1が暗側平均値となる。
In the following procedure (2), a gradation value equal to or smaller than the reference value γ is designated, that is, gradation values “0” to “γ” are designated, and a range average value calculation process is executed. In this case, FIG.
As shown in (b), the lower gradation value a1 and the upper gradation value b
1 is calculated, and the arithmetic mean c1 is calculated. Then, the arithmetic mean c1 becomes the dark side average value.

【0019】また、手順(2)では、基準値γ以上の階
調値が指定され、すなわち、階調値「γ」〜「255」
が指定され、範囲平均値算出処理が実行される。この場
合、図4(b)に示すように、下方階調値a2及び上方
階調値b2が算出され、相加平均c2が算出される。そ
して、この相加平均c2が明側平均値となる。
In step (2), a tone value equal to or greater than the reference value γ is designated, that is, tone values “γ” to “255”.
Is specified, and the range average value calculation process is executed. In this case, as shown in FIG. 4B, the lower gradation value a2 and the upper gradation value b2 are calculated, and the arithmetic mean c2 is calculated. Then, the arithmetic mean c2 becomes a light-side average value.

【0020】続く手順(3)では、図4(b)に示すよ
うに、手順(2)で求めた暗側平均値c1と明側平均値
c2との相加平均γ’を境界値として求める。そして、
手順(4)では、この境界値γ’と(1)で求めた基準
値γとを比較する。そして、境界値γ’と基準値γとの
差が予め定められた値以下となっている場合には、境界
値γ’を閾値γ’として決定する。一方、境界値γ’と
前記基準値γとの差が予め定められた値よりも大きい場
合には、境界値γ’を新たな基準値として、上記(2)
からの手順を繰り返す。
In the following step (3), as shown in FIG. 4B, the arithmetic mean γ ′ of the dark side average value c1 and the light side average value c2 obtained in step (2) is obtained as a boundary value. . And
In step (4), the boundary value γ ′ is compared with the reference value γ obtained in (1). When the difference between the boundary value γ ′ and the reference value γ is equal to or smaller than a predetermined value, the boundary value γ ′ is determined as the threshold γ ′. On the other hand, when the difference between the boundary value γ ′ and the reference value γ is larger than a predetermined value, the boundary value γ ′ is set as a new reference value and the above (2)
Repeat steps from.

【0021】つまり、上記(2)からの手順が繰り返さ
れると、暗側平均値は、「暗」に相当する画素の分布の
平均階調値に近づき、一方、明側平均値は、「明」に相
当する画素の分布の平均階調値に近づく。したがって、
手順(3)にて算出される境界値は、ある値にしだいに
収束していき、手順(4)にて閾値が決定されるのであ
る。
That is, when the procedure from the above (2) is repeated, the average value on the dark side approaches the average gradation value of the distribution of pixels corresponding to “dark”, while the average value on the light side is “bright”. ”Approaches the average gradation value of the pixel distribution corresponding to“. Therefore,
The boundary value calculated in step (3) gradually converges to a certain value, and the threshold is determined in step (4).

【0022】従来、全画素の中の暗い側10%、明るい
側10%が含まれるような階調値を求めて、その相加平
均を閾値とする手法があった。しかし、この場合、例え
ば画像中の情報コードの占める面積が背景画像に比べて
極端に小さくなった場合、すなわち「暗」に相当する画
素が「明」に相当する画素に比べて極端に少なくなる
と、図11(b)に示すように、算出される閾値γ2が
階調値の高い側(明るい側)にずれて、その結果、
「明」に相当する画素(図11(b)中に記号Aで示し
た)が「暗」として2値化されるという不都合が生じて
いた。
Conventionally, there has been a method in which a gradation value that includes 10% of the dark side and 10% of the bright side in all the pixels is obtained, and the arithmetic mean thereof is used as a threshold value. However, in this case, for example, when the area occupied by the information code in the image is extremely small compared to the background image, that is, when the pixels corresponding to “dark” are extremely small compared to the pixels corresponding to “bright”. As shown in FIG. 11B, the calculated threshold value γ2 is shifted to a higher gradation value (brighter side), and as a result,
The pixel corresponding to "bright" (indicated by symbol A in FIG. 11B) is inconveniently binarized as "dark".

【0023】これに対して、本発明では、境界値(基準
値)以下の画素を「暗」側の画素として、この「暗」側
の画素の平均階調値(暗側平均値)を求めると共に、境
界値以上の画素を「明」側の画素として、この「明」側
の画素の平均階調値(明側平均値)を求めて(上記手順
(2))、さらにその相加平均を新たな境界値とすると
いう処理を繰り返して閾値を決定する(上記手順
(3),(4))。すなわち、「暗」側の画素と「明」
側の画素のぞれぞれの平均の階調値を求めて処理するよ
うにしたため、「暗」の側の画素と「明」の側の画素の
個数が極端に違っていても、「暗」に相当する画素と
「明」に相当する画素を適切に切り分けるような閾値を
決定することができる。その結果、取り込んだ画像デー
タ中の情報コード領域と背景領域との面積比が変化して
も、適切に多値データを2値化することができる。
On the other hand, in the present invention, a pixel below the boundary value (reference value) is regarded as a pixel on the "dark" side, and an average gradation value (average value on the dark side) of the pixel on the "dark" side is obtained. At the same time, a pixel which is equal to or larger than the boundary value is defined as a pixel on the “bright” side, and an average tone value (bright side average value) of the pixel on the “bright” side is calculated (the above procedure (2)). Is determined as a new boundary value, and the threshold is determined (the above procedures (3) and (4)). In other words, the pixels on the “dark” side and “bright”
Since the average tone value of each of the pixels on the side is calculated and processed, even if the number of pixels on the “dark” side and the number of pixels on the “bright” side are extremely different, ”And a pixel corresponding to“ bright ”can be determined appropriately. As a result, even if the area ratio between the information code area and the background area in the captured image data changes, the multi-value data can be appropriately binarized.

【0024】また、「暗」又は「明」側の画素の平均階
調値を求めるにあたって、対象となる画素のうちで階調
値の低い側と高い側の所定割合の画素を含む階調値(下
方階調値、上方階調値)を算出し、「暗」又は「明」側
の画素の平均階調値を求める。したがって、「暗」又は
「明」に対応する画素の分布に最頻値が存在しない場合
であっても適切に閾値を決定することができる。
In calculating the average tone value of the pixels on the "dark" or "bright" side, the tone value including a predetermined percentage of the pixels having the lower and higher tone values among the target pixels. (Lower gradation value, upper gradation value) is calculated, and the average gradation value of the pixels on the “dark” or “bright” side is calculated. Therefore, even when the mode does not exist in the distribution of the pixels corresponding to “dark” or “bright”, the threshold can be appropriately determined.

【0025】ところで、上述した方法は、画像データ全
体の画素を「暗」側の画素と「明」側の画素に分けると
いう工夫であったが、閾値として決定すべき階調値近傍
の画素の個数は、その階調値の前後の適当な範囲で等し
くなるはずである。図4(a)からも分かるように、
「暗」に相当する画素の分布と「明」に相当する画素の
分布の間の範囲では画素の個数が平坦になっているから
である。この前提に基づけば、例えば請求項2に示すよ
うな2値化方法を採用することも考えられる。
The above-mentioned method is designed to divide the pixels of the entire image data into pixels on the "dark" side and pixels on the "bright" side. The number should be equal in an appropriate range before and after the gradation value. As can be seen from FIG.
This is because the number of pixels is flat in a range between the distribution of pixels corresponding to “dark” and the distribution of pixels corresponding to “bright”. Based on this premise, it is conceivable to adopt, for example, a binarization method as described in claim 2.

【0026】本発明の2値化方法においても、2値化を
行う基本手順は、上述した請求項1に記載の発明と同様
である。そして、閾値決定処理のみが異なるため、この
閾値決定処理について説明する。本発明の2値化方法に
おける閾値決定処理は、平均値算出処理を含んでいる。
そこで最初に、この平均値算出処理を説明する。
In the binarization method of the present invention, the basic procedure for binarization is the same as that of the first aspect. Since only the threshold value determining process is different, the threshold value determining process will be described. The threshold value determination processing in the binarization method of the present invention includes an average value calculation processing.
Therefore, the average value calculation processing will be described first.

【0027】平均値算出処理では、下側階調値と、上側
階調値とを求め、その両方の階調値の相加平均を求め
る。下側階調値は、指定された階調値よりも小さな階調
値であって、当該下側階調値から指定された階調値まで
の範囲に所定個数の画素が含まれるような階調値をい
う。一方、上側階調値は、指定された階調値よりも大き
な階調値であって、指定された階調値から上側階調値ま
での範囲に所定個数の画素が含まれるような階調値をい
う。
In the average value calculation processing, a lower gradation value and an upper gradation value are obtained, and an arithmetic average of both the gradation values is obtained. The lower gradation value is a gradation value smaller than the designated gradation value, and is a gradation value such that a predetermined number of pixels are included in a range from the lower gradation value to the designated gradation value. Refers to the key value. On the other hand, the upper gradation value is a gradation value larger than the designated gradation value and includes a predetermined number of pixels in a range from the designated gradation value to the upper gradation value. Value.

【0028】例えば図6は、図4(a)に示した閾値γ
付近の画素の個数と階調値との対応関係を拡大して示し
た説明図である。なお、図6中の階調値γは、図4
(a)の階調値γに対応している。この図6において、
階調値γが指定された場合、指定された階調値γ以下の
画素のうちの所定個数の画素が範囲Dに入るのであれ
ば、階調値aが下側階調値となる。一方、指定された階
調値γ以上の画素のうちの所定個数の画素が範囲Cに入
るのであれば、階調値bが上側階調値となる。したがっ
て、階調値γを指定して、平均値算出処理を実行すれ
ば、下側階調値aと上側階調値bとの相加平均γ’が算
出される。
For example, FIG. 6 shows the threshold value γ shown in FIG.
FIG. 5 is an explanatory diagram showing an enlarged correspondence relationship between the number of pixels in the vicinity and a gradation value. Note that the gradation value γ in FIG.
This corresponds to the gradation value γ in (a). In FIG.
When the gradation value γ is designated, if a predetermined number of pixels among the pixels having the designated gradation value γ or less fall within the range D, the gradation value a becomes the lower gradation value. On the other hand, if a predetermined number of pixels among the pixels having the designated gradation value γ or more fall within the range C, the gradation value b becomes the upper gradation value. Therefore, if the average value calculation process is executed with the gradation value γ specified, the arithmetic mean γ ′ of the lower gradation value a and the upper gradation value b is calculated.

【0029】このような平均値算出処理を含む閾値決定
処理は、次に示す手順(1)〜(3)にて実行される。
以下、手順(1)〜(3)を具体的に説明する。まず手
順(1)では、全画素のうちの相対的に小さな階調値を
有する所定割合の画素の有する最大の階調値と、全画素
のうちの相対的に大きな階調値を有する所定割合の画素
の有する最小の階調値とを求めて、当該階調値の相加平
均を基準値として求める。この処理は、請求項1に記載
の2値化方法の手順(1)と同様のものである。
The threshold value determination processing including the average value calculation processing is executed in the following procedures (1) to (3).
Hereinafter, the procedures (1) to (3) will be specifically described. First, in the procedure (1), the maximum gradation value of a predetermined proportion of pixels having a relatively small gradation value among all pixels and the predetermined proportion of a relatively large gradation value of all pixels And the minimum gradation value of the pixel is obtained, and the arithmetic mean of the gradation values is used as a reference value. This processing is the same as the procedure (1) of the binarization method according to the first aspect.

【0030】続く手順(2)では、手順(1)にて算出
された基準値を指定し、平均値算出処理にて算出される
相加平均を境界値とする。具体的に言えば、手順(1)
では、図4(a)に示すように、階調値α及び階調値β
を求めて、相加平均γを算出して基準値とする。手順
(2)では、図6に示したように、平均値算出処理によ
って、基準値γ前後のそれぞれで所定個数の画素を含む
下側階調値aと上側階調値bとを求めて、相加平均γ’
を境界値として算出する。
In the following procedure (2), the reference value calculated in the procedure (1) is designated, and the arithmetic mean calculated in the average value calculation processing is set as a boundary value. Specifically, procedure (1)
Then, as shown in FIG. 4A, the gradation value α and the gradation value β
, And an arithmetic mean γ is calculated and used as a reference value. In the procedure (2), as shown in FIG. 6, a lower gradation value a and an upper gradation value b including a predetermined number of pixels before and after the reference value γ are obtained by an average value calculation process. Arithmetic mean γ '
Is calculated as a boundary value.

【0031】そして、手順(3)では、境界値と基準値
との差が予め定められた値以下となっている場合には、
境界値を閾値として決定する。一方、境界値と基準値と
の差が予め定められた値よりも大きい場合には、境界値
を新たな基準値として、上記(2)からの手順を繰り返
す。境界値γ’と基準値γとの差が予め定められた値以
下となっている場合とは、境界値γ’がある程度収束し
た場合をいう。
In the procedure (3), when the difference between the boundary value and the reference value is equal to or smaller than a predetermined value,
The boundary value is determined as a threshold. On the other hand, when the difference between the boundary value and the reference value is larger than a predetermined value, the procedure from (2) is repeated using the boundary value as a new reference value. The case where the difference between the boundary value γ ′ and the reference value γ is equal to or smaller than a predetermined value refers to the case where the boundary value γ ′ has converged to some extent.

【0032】つまり、手順(2)及び(3)を繰り返せ
ば、階調値に対する画素の個数の分布が境界値γ’の前
後の適当な範囲で一定となるまで境界値γ’は移動する
ことになる。図4では、境界値γ’は、基準値γより
も、左方向(「暗」側の画素方向)へ移動して収束す
る。
That is, if the procedures (2) and (3) are repeated, the boundary value γ ′ moves until the distribution of the number of pixels with respect to the gradation value becomes constant in an appropriate range before and after the boundary value γ ′. become. In FIG. 4, the boundary value γ ′ moves to the left (the pixel direction on the “dark” side) and converges to the reference value γ.

【0033】本発明は、「暗」に相当する画素の分布と
「明」に相当する画素の分布との間の範囲では、画素の
個数が一定となっていることに着目したものであり、閾
値近傍の画素の分布に従い閾値を補正する。これによっ
て、「暗」の側の画素と「明」の側の画素の個数が極端
に違っていても、「暗」に相当する画素と「明」に相当
する画素を適切に切り分けるような閾値を決定すること
ができる。その結果、取り込んだ画像データ中の情報コ
ード領域と背景領域との面積比が変化しても、適切に多
値データを2値化することができる。
The present invention focuses on the fact that the number of pixels is constant in a range between the distribution of pixels corresponding to "dark" and the distribution of pixels corresponding to "bright". The threshold is corrected according to the distribution of pixels near the threshold. With this, even if the number of pixels on the “dark” side and the number of pixels on the “bright” side are extremely different, a threshold value that appropriately separates pixels corresponding to “dark” and pixels corresponding to “bright” can be obtained. Can be determined. As a result, even if the area ratio between the information code area and the background area in the captured image data changes, the multi-value data can be appropriately binarized.

【0034】また、階調値付近の画素の分布に従って閾
値を決定するため、「暗」又は「明」側の画素の分布に
最頻値が存在しない場合であっても適切に閾値を決定す
ることができる。なお、平均値算出処理における所定個
数は、境界値と基準値との差に応じて決定することが考
えられる。境界値と基準値との差が小さい場合には、所
定個数を大きくする。逆に、境界値と基準値との差が大
きい場合には、所定個数を小さくする。所定個数を大き
くしたり、所定個数を小さくしたりすることによって、
算出される境界値の収束時間が変わるためである。この
ようにすれば、上記手順(2)において算出される境界
値を適切な速度で収束させることができる。
Further, since the threshold value is determined in accordance with the distribution of pixels near the gradation value, the threshold value is determined appropriately even when the mode does not exist in the distribution of pixels on the "dark" or "bright" side. be able to. Note that the predetermined number in the average value calculation process may be determined according to the difference between the boundary value and the reference value. When the difference between the boundary value and the reference value is small, the predetermined number is increased. Conversely, when the difference between the boundary value and the reference value is large, the predetermined number is reduced. By increasing the predetermined number or decreasing the predetermined number,
This is because the convergence time of the calculated boundary value changes. With this configuration, the boundary value calculated in the procedure (2) can be converged at an appropriate speed.

【0035】ところで、請求項1に記載の方法は、画素
を「暗」側の画素と「明」側の画素に分けることによっ
て、また、請求項2に記載の方法は、境界値付近の画素
の分布によって、適切な閾値を決定するものであった。
つまり、画素の全体の分布には、「暗」側の画素の分布
と「明」側の画素の分布のみが存在することを前提とし
ていた。しかし、例えば情報コードが印刷されている情
報記録面に情報コードに重ねて図柄が印刷されているよ
うな場合も考えられる。この図柄は、例えば薄い青色な
どで印刷されていることが考えられ、その場合、この図
柄部分に対応する画素は、「明」に相当する画素と
「暗」に相当する画素の中間あたりの階調値を持つこと
が考えられる。図示すれば、例えば図8(b)に記号B
で示すような分布が現れるという具合である。
According to the first aspect of the present invention, the pixels are divided into pixels on the "dark" side and pixels on the "bright" side. , An appropriate threshold was determined.
In other words, it is assumed that only the distribution of pixels on the “dark” side and the distribution of pixels on the “bright” side exist in the overall distribution of pixels. However, for example, a case may be considered in which a symbol is printed on the information recording surface on which the information code is printed so as to overlap the information code. It is conceivable that this symbol is printed in light blue, for example, and in that case, the pixel corresponding to the symbol portion is a floor around the middle of the pixel corresponding to “bright” and the pixel corresponding to “dark”. It is possible to have a tonal value. For example, FIG. 8B shows a symbol B
A distribution as shown by appears.

【0036】そして、この図柄の部分は、情報コードと
切り分けるために「明」として2値化したいのである
が、例えば請求項1に示した方法によれば、図柄部分に
相当する画素が「暗」側の画素と見なされることも考え
られる。この場合、この図柄に対応する画素は、「暗」
として2値化される可能性がある。また、例えば請求項
2に示した方法によれば、図8(b)から分かるよう
に、「明」に相当する画素の分布と、図柄部分に相当す
る画素の分布との境界部分に閾値が決定される可能性が
ある。そのため、この場合も、図柄に対応する画素は、
「暗」として2値化される可能性がある。
It is desired to binarize the symbol portion as "bright" in order to separate it from the information code. For example, according to the method described in claim 1, a pixel corresponding to the symbol portion is "dark". It is also conceivable that the pixel is regarded as the pixel on the "" side. In this case, the pixel corresponding to this symbol is “dark”
May be binarized. According to the method described in claim 2, for example, as can be seen from FIG. 8B, the threshold value is set at the boundary between the distribution of pixels corresponding to “bright” and the distribution of pixels corresponding to the design portion. May be determined. Therefore, also in this case, the pixel corresponding to the design is
It may be binarized as “dark”.

【0037】そこで、請求項3に示すような方法を採用
することが考えられる。本発明においても、2値化を行
う基本手順は、上述した請求項1及び2に記載の発明と
同様である。そして、閾値決定処理が異なるため、この
閾値決定処理を説明する。
Therefore, it is conceivable to adopt a method as described in claim 3. Also in the present invention, the basic procedure for performing binarization is the same as in the first and second aspects of the present invention. Since the threshold value determination processing is different, the threshold value determination processing will be described.

【0038】本発明の2値化方法における閾値決定処理
は、次の手順(1)〜(3)によって実行される。手順
(1)〜(3)を図8(a)及び図9に基づいて具体的
に説明する。なお、図8(a)では、画像データ全体に
中間調の図柄が印刷されているものとして説明する。
The threshold value determination processing in the binarization method of the present invention is executed according to the following procedures (1) to (3). Procedures (1) to (3) will be specifically described with reference to FIGS. In FIG. 8A, a description is given on the assumption that a halftone pattern is printed on the entire image data.

【0039】まず手順(1)では、画像データ全体を、
所定数の画素を含む小エリアに分割し、当該小エリアに
含まれる画素の最大の階調値と最小の階調値との差を算
出する。例えば、画像データ全体を、図8(a)に示す
ように、小エリアe1,e2,e3,・・・という具合
に分割する。なお、例えば一つの小エリアは3×3画素
の領域とすることが考えられる。そして、各小エリアe
1,e2,e3,・・・のそれぞれに含まれる画素の有
する最大の階調値と最小の階調値との差を算出する。図
8(a)に示した小エリアe8,e9は、情報コードの
一部がそのエリア内の一部にあるため、最大階調値と最
小階調値との差は大きくなる。一方、小エリアe1〜e
7では、中間調の図柄部分に対応する画素と「明」の画
素の階調値の差となるため、小エリアe8,e9に比べ
て、最大階調値と最小階調値との差は小さくなる。
First, in step (1), the entire image data is
The image is divided into small areas including a predetermined number of pixels, and the difference between the maximum gradation value and the minimum gradation value of the pixels included in the small area is calculated. For example, the entire image data is divided into small areas e1, e2, e3,... As shown in FIG. Note that, for example, one small area may be a 3 × 3 pixel area. And each small area e
The difference between the maximum gradation value and the minimum gradation value of the pixel included in each of the pixels 1, e2, e3,... Is calculated. In the small areas e8 and e9 shown in FIG. 8A, the difference between the maximum gradation value and the minimum gradation value is large because a part of the information code is in a part of the area. On the other hand, small areas e1 to e
7, the difference between the tone value of the pixel corresponding to the halftone pattern portion and the tone value of the "bright" pixel is smaller than that of the small areas e8 and e9. Become smaller.

【0040】続く手順(2)では、小エリア毎の最大階
調値と最小階調値との差の分布に基づいて、差が大きい
側に分布する小エリアについて当該差の平均を求める。
この差の分布は図9に示す如くである。上述したよう
に、小エリアe1〜e7に対して算出される差は、相対
的に小さくなるため、これらのエリアについては、階調
差の小さい側に分布する。一方、小エリアe8,e9に
対して算出される差は、相対的に大きくなるため、これ
らのエリアについては、階調差の大きい側に分布する。
差が大きい側に分布する小エリアについての差の平均
は、図9では階調差d2に相当する。この階調差d2
は、図8(b)中のd2におおよそ対応するものであ
る。
In the following procedure (2), based on the distribution of the difference between the maximum gradation value and the minimum gradation value for each small area, the average of the differences is determined for the small areas distributed on the side where the difference is large.
The distribution of this difference is as shown in FIG. As described above, since the difference calculated for the small areas e1 to e7 is relatively small, these areas are distributed on the side where the gradation difference is small. On the other hand, since the difference calculated for the small areas e8 and e9 is relatively large, these areas are distributed on the side where the gradation difference is large.
The average of the differences for the small areas distributed on the side where the difference is larger corresponds to the gradation difference d2 in FIG. This gradation difference d2
Corresponds roughly to d2 in FIG. 8 (b).

【0041】また、手順(2)では、所定数の小エリア
にて構成される基準エリアを単位として、当該基準エリ
アに含まれる小エリアの最大又は最小の階調値の相加平
均を求める。基準エリアは、所定数の小エリアから構成
される。例えば、図8(a)では、縦横3つずつの小エ
リアから基準エリアが構成され、画像データ全体が6つ
の基準エリアで構成されている。小エリアe1〜e9の
9つの小エリアが基準エリアに相当するという具合であ
る。なお、画像データの全エリアを基準エリアとしても
よいが、後述するようにこの基準エリア単位で閾値が決
定されるため、画像データをいくつかの基準エリアに分
けた方が適切な閾値が決定されるという点で有利であ
る。
In the procedure (2), the arithmetic mean of the maximum or minimum tone value of the small area included in the reference area is determined in units of a reference area composed of a predetermined number of small areas. The reference area includes a predetermined number of small areas. For example, in FIG. 8A, the reference area is composed of three small areas each of which is vertical and horizontal, and the entire image data is composed of six reference areas. The nine small areas e1 to e9 correspond to the reference area. Note that the entire area of the image data may be set as the reference area, but the threshold is determined in units of the reference area as described later, so that dividing the image data into several reference areas determines an appropriate threshold. This is advantageous in that

【0042】一の基準エリアに対する画素の分布が図8
(b)のようになるのであれば、最小の階調値の平均
は、おおよそ「暗」に対応する画素の分布の最頻値辺り
に算出される(記号h1で示した)。一方、最大の階調
値の平均は、おおよそ「明」に対応する画素の分布の最
頻値辺りに算出される(記号h2で示した)。
FIG. 8 shows the distribution of pixels for one reference area.
In the case of (b), the average of the minimum gradation values is calculated around the mode of the distribution of the pixels corresponding to “dark” (indicated by the symbol h1). On the other hand, the average of the maximum gradation values is calculated around the mode of the distribution of pixels corresponding to “bright” (indicated by the symbol h2).

【0043】そして、続く手順(3)では、最小又は最
大の階調値の相加平均を差の平均にて補正して閾値を決
定する。上記手順(2)では、差の平均として図8
(b)に示した差d2が算出される。したがって、手順
(2)にて最小の階調値h1を求める場合、このd2を
所定倍してh1に足した値を閾値として決定するという
具合である。例えば図8(b)では、階調値h1に(1
/4)×d2を足して閾値γ’を求めている。一方、手
順(2)にて最大の階調値h2を求める場合、このd2
を所定倍してh2から引いた値を閾値として決定すると
いう具合である。例えば図8(b)では、階調値h2か
ら(3/4)×d2を引いて閾値γ’を求めている。
In the following procedure (3), a threshold value is determined by correcting the arithmetic mean of the minimum or maximum gradation value by the average of the differences. In the above procedure (2), the difference is calculated as the average of FIG.
The difference d2 shown in (b) is calculated. Therefore, when the minimum gradation value h1 is obtained in the procedure (2), d2 is multiplied by a predetermined value and the value added to h1 is determined as the threshold. For example, in FIG. 8B, (1) is set to the gradation value h1.
/ 4) × d2 to obtain a threshold value γ ′. On the other hand, when the maximum gradation value h2 is obtained in the procedure (2), this d2
Is multiplied by a predetermined value, and a value obtained by subtracting from h2 is determined as the threshold. For example, in FIG. 8B, the threshold value γ ′ is obtained by subtracting (3/4) × d2 from the gradation value h2.

【0044】つまり、この方法は、「暗」に相当する画
素の分布と、「明」に相当する画素の分布との平均の差
を求め、この差に応じて閾値を決定する。これによっ
て、図8(b)に示すように、中間調である図柄部分に
相当する画素の分布を考慮して閾値を決定することがで
きる。その結果、図柄と重ねて印刷されている情報コー
ドであっても、適切な閾値を設定することができる。
That is, in this method, the average difference between the distribution of pixels corresponding to “dark” and the distribution of pixels corresponding to “bright” is obtained, and a threshold value is determined according to the difference. As a result, as shown in FIG. 8B, the threshold value can be determined in consideration of the distribution of pixels corresponding to a design portion that is a halftone. As a result, an appropriate threshold value can be set even for an information code printed over a symbol.

【0045】なお、以上は、情報コードの2値化方法の
発明として説明してきたが、この2値化方法を用いた光
学情報読取装置の発明として実現することもできる。す
なわち、請求項1〜4のいずれかに記載の2値化方法を
用いて光学情報を読み取るよう構成されていることを特
徴とする光学情報読取装置である。
Although the invention has been described as an invention of a method for binarizing an information code, the invention can also be realized as an invention of an optical information reading apparatus using this binarization method. That is, an optical information reading apparatus is configured to read optical information using the binarization method according to any one of claims 1 to 4.

【0046】また、同様に、この2値化方法を用いて情
報コードの品質判断をするための装置を構成してもよ
い。すなわち、請求項1〜4のいずれかに記載の2値化
方法を用いて読取対象の情報コードを画像データとして
復元するコード品質判断補助装置である。この品質判断
補助装置にて復元された画像データに基づいて、印刷さ
れた情報コードの印刷品質等を評価すれば、画像データ
中の背景領域の大きさに関係なく、情報コードの品質を
適切に判断することができる。
Similarly, an apparatus for judging the quality of an information code using this binarization method may be configured. That is, the present invention is a code quality determination assisting device that restores an information code to be read as image data using the binarization method according to any one of claims 1 to 4. If the print quality of the printed information code is evaluated based on the image data restored by the quality judgment assisting device, the quality of the information code can be appropriately adjusted regardless of the size of the background area in the image data. You can judge.

【0047】[0047]

【発明の実施の形態】以下、本発明を具体化した一実施
形態を図面を参照して説明する。 [第1実施形態]図1は、第1実施形態の2次元コード
読取装置1のブロック図である。本第1実施形態の2次
元コード読取装置1は、読取制御回路10と、照明用発
光ダイオード(照明LED)11と、CCDエリアセン
サ12と、増幅回路13と、A/D変換回路14と、ア
ドレス発生回路15と、同期パルス出力回路16と、画
像メモリ20と、システム制御回路30と、スイッチ群
31と、液晶表示器32と、通信I/F回路33と中心
にして構成されている。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to the drawings. [First Embodiment] FIG. 1 is a block diagram of a two-dimensional code reader 1 according to a first embodiment. The two-dimensional code reader 1 according to the first embodiment includes a read control circuit 10, a light emitting diode (illumination LED) 11, a CCD area sensor 12, an amplification circuit 13, an A / D conversion circuit 14, The configuration mainly includes an address generation circuit 15, a synchronization pulse output circuit 16, an image memory 20, a system control circuit 30, a switch group 31, a liquid crystal display 32, and a communication I / F circuit 33.

【0048】読取制御回路10及びシステム制御回路3
0は、CPU、ROM、RAM、I/O等を備えたコン
ピュータシステムとして構成されている。読取制御回路
10は、ROMに記憶されているプログラムに従って後
述する閾値決定処理等を実行する。一方、システム制御
回路30には、スイッチ群31、液晶表示器32及び通
信I/F回路33が接続されており、システム制御回路
30は、入出力制御を主として行う。
Read control circuit 10 and system control circuit 3
0 is configured as a computer system including a CPU, a ROM, a RAM, an I / O, and the like. The read control circuit 10 executes a threshold value determination process described later according to a program stored in the ROM. On the other hand, a switch group 31, a liquid crystal display 32, and a communication I / F circuit 33 are connected to the system control circuit 30, and the system control circuit 30 mainly performs input / output control.

【0049】照明LED11は、読取対象の光学情報で
ある2次元コードに対して照明用の赤色光を照射するも
のである。CCDエリアセンサ12は、2次元的に配列
された複数の受光素子であるCCDを有しており、外界
を撮像してその2次元画像を水平方向の走査線信号とし
て出力する。なお、本第1実施形態では、このCCDエ
リアセンサ12からの「アナログ画像信号」としての走
査線信号は増幅回路13によって増幅されA/D変換回
路14に出力される。
The illumination LED 11 emits red light for illumination to a two-dimensional code which is optical information to be read. The CCD area sensor 12 has a plurality of two-dimensionally arranged CCDs, which are light receiving elements, captures the outside world, and outputs the two-dimensional image as a horizontal scanning line signal. In the first embodiment, the scanning line signal as the “analog image signal” from the CCD area sensor 12 is amplified by the amplifier circuit 13 and output to the A / D conversion circuit 14.

【0050】この増幅回路13は、読取制御回路10か
ら入力したゲインコントロール電圧に対応する増幅率
で、CCDエリアセンサ12から出力された走査線信号
を増幅する。A/D変換回路14はアナログの走査線信
号をディジタル信号に変換して、画像メモリ20に出力
する。A/D変換回路14にてディジタル信号に変換さ
れたデータは多値データであり、この多値データは画像
メモリ20の多値データ記憶領域20aに記憶される。
また、この多値データは、各画素が8ビット(「0」〜
「255」)の階調値を有するものとなっている。
The amplification circuit 13 amplifies the scanning line signal output from the CCD area sensor 12 with an amplification factor corresponding to the gain control voltage input from the reading control circuit 10. The A / D conversion circuit 14 converts an analog scanning line signal into a digital signal and outputs the digital signal to the image memory 20. The data converted into a digital signal by the A / D conversion circuit 14 is multi-value data, and the multi-value data is stored in a multi-value data storage area 20 a of the image memory 20.
In addition, in this multi-valued data, each pixel has 8 bits (“0” to
"255").

【0051】同期パルス出力回路16は、CCDエリア
センサ12から出力される2次元画像データのパルスよ
り十分に細かい同期パルスを出力する。アドレス発生回
路15はこの同期パルスをカウントして、画像メモリ2
0の多値データ記憶領域20aに対するアドレスを発生
させる。多値データは、アドレス毎に8ビット単位で書
き込まれる。
The synchronizing pulse output circuit 16 outputs a synchronizing pulse sufficiently finer than the two-dimensional image data pulse output from the CCD area sensor 12. The address generation circuit 15 counts this synchronization pulse and outputs
An address for the multi-value data storage area 20a of 0 is generated. The multilevel data is written in 8-bit units for each address.

【0052】読取制御回路10は、画像メモリ20の多
値データ記憶領域20aに記憶された多値データを読み
出し、この多値データに基づいて2値化のための閾値を
決定する閾値決定処理を実行する。そして、この閾値決
定処理にて決定された閾値に基づいて、読み出した多値
データを2値データに変換(2値化)し、再び画像メモ
リ20の2値データ記憶領域20bに記憶する。
The read control circuit 10 reads out multi-value data stored in the multi-value data storage area 20a of the image memory 20, and performs a threshold value determination process for determining a threshold value for binarization based on the multi-value data. Execute. Then, based on the threshold value determined in the threshold value determination process, the read multi-value data is converted into binary data (binarization), and stored in the binary data storage area 20b of the image memory 20 again.

【0053】スイッチ群31は、利用者が読取処理の開
始を指示するための読取スイッチや、テンキーあるいは
各種ファンクションキーを備えており、情報入力のため
に用いられる。液晶表示器32は、例えば2階調表示の
LCDとして構成されており、読み込んだ光学情報など
を表示するためなどに用いられる。
The switch group 31 includes a reading switch for instructing the user to start reading processing, a numeric keypad, and various function keys, and is used for inputting information. The liquid crystal display 32 is configured as, for example, a two-tone LCD, and is used for displaying read optical information and the like.

【0054】通信I/F回路33は、図示しない外部装
置との間で通信を行うものであり、図示しない通信用発
光素子を介してデータを外部装置に送信したり、図示し
ない通信用受光素子を介して外部装置からの信号(例え
ばシステムを動かすためのプログラムや送信を待機する
命令等)を受信する。
The communication I / F circuit 33 communicates with an external device (not shown), and transmits data to the external device via a communication light emitting element (not shown), or transmits light to a communication light receiving element (not shown). (For example, a program for operating the system and an instruction to wait for transmission) from the external device.

【0055】このような構成を備えた本第1実施形態の
2次元コード読取装置1は、CCDエリアセンサ12か
ら出力される走査線信号を増幅回路13によって増幅
し、その増幅された走査線信号をA/D変換回路14に
よって多値データに変換して画像メモリ20の多値デー
タ記憶領域20aに記憶する。そして、読取制御回路1
0が、多値データ記憶領域20aに記憶された多値デー
タに基づいて、閾値決定処理を実行する。そして、閾値
決定処理にて決定された閾値によって、多値データを2
値化し、2値データとして画像メモリ20の2値データ
記憶領域20aに記憶する。そして、読取制御回路10
は、次に光学情報の読取処理を実行し、画像メモリ20
の2値データ記憶領域20aに記憶された2値データに
基づいて、光学情報を読み取る。
The two-dimensional code reader 1 according to the first embodiment having the above-described configuration amplifies the scanning line signal output from the CCD area sensor 12 by the amplifier circuit 13, and amplifies the amplified scanning line signal. Is converted into multi-value data by the A / D conversion circuit 14 and stored in the multi-value data storage area 20a of the image memory 20. Then, the reading control circuit 1
0 executes a threshold value determination process based on the multi-value data stored in the multi-value data storage area 20a. Then, the multi-valued data is converted to 2 by the threshold value determined in the threshold value determination process.
It is converted into a value and stored as binary data in a binary data storage area 20a of the image memory 20. Then, the reading control circuit 10
Executes the reading process of the optical information, and the image memory 20
The optical information is read based on the binary data stored in the binary data storage area 20a.

【0056】本第1実施形態の2次元コード読取装置1
は、上述した閾値決定処理に特徴を有している。そこで
次に、図面に基づいて、読取制御回路10にて実行され
る閾値決定処理を説明する。なお、この閾値決定処理に
は、指定範囲平均値算出処理が含まれているため、まず
最初に、図3のフローチャートに基づいて、この指定範
囲平均値算出処理を説明し、その後、図2のフローチャ
ートに基づいて、閾値決定処理を説明する。
The two-dimensional code reader 1 of the first embodiment
Has a feature in the above-described threshold value determination processing. Therefore, next, a threshold value determining process executed by the reading control circuit 10 will be described with reference to the drawings. Since the threshold value determination processing includes the specified range average value calculation processing, the specified range average value calculation processing will be described first based on the flowchart of FIG. The threshold value determination processing will be described based on a flowchart.

【0057】図3中の最初のステップS300におい
て、指定範囲の階調値を有する画素の中で所定条件を満
たす画素を選択する。指定範囲平均値算出処理は、後述
する閾値決定処理からコールされるのであるが、閾値決
定処理において階調値の範囲が指定される。したがっ
て、ここでは指定された範囲の階調値を有する画素を対
象に処理を行う。具体的には、指定範囲の階調値を有す
る画素の中で相対的に小さな階調値を有する10%の画
素を選択する。
In the first step S300 in FIG. 3, a pixel satisfying a predetermined condition is selected from pixels having a gradation value in a specified range. The specified range average value calculation process is called from a threshold value determination process described later, and a range of gradation values is specified in the threshold value determination process. Therefore, here, the processing is performed on the pixels having the gradation values in the specified range. Specifically, 10% of the pixels having relatively small gradation values are selected from the pixels having the gradation values in the specified range.

【0058】続くS310では、S300にて選択され
た画素の有する階調値の中で最大の階調値を下方階調値
とする。次のS320では、指定範囲の階調値を有する
画素の中で所定条件を満たす画素を選択する。ここで
は、指定範囲の階調値を有する画素の中で相対的に大き
な階調値を有する10%の画素を選択する。
At S310, the maximum gradation value among the gradation values of the pixel selected at S300 is set as the lower gradation value. In the next step S320, a pixel satisfying a predetermined condition is selected from the pixels having the gradation value in the specified range. Here, 10% of pixels having relatively large gradation values are selected from the pixels having gradation values in the specified range.

【0059】続くS330では、S320にて選択され
た画素の有する階調値の中で最小の階調値を上方階調値
とする。そして、次のS340では、S310にて算出
された下方階調値と、S330にて算出された上方階調
値との相加平均を求め、その後、コール元の処理ステッ
プへ戻る。
At S330, the smallest gradation value among the gradation values of the pixel selected at S320 is set as the upper gradation value. Then, in the next S340, an arithmetic mean of the lower gradation value calculated in S310 and the upper gradation value calculated in S330 is obtained, and thereafter, the process returns to the processing step of the caller.

【0060】以上が指定範囲平均値算出処理である。続
けて、図2のフローチャートに基づいて、閾値決定処理
を説明する。まず最初のステップS100において、全
範囲の階調値「0」〜「255」を指定する。続くS1
10にて、図3を用いて上述した指定範囲平均値算出処
理をコールする。そして、次のS120では、指定範囲
平均値算出処理にて求められた相加平均γを基準値とす
る。
The above is the designated range average value calculation processing. Subsequently, the threshold value determination processing will be described based on the flowchart of FIG. First, in the first step S100, the gradation values "0" to "255" of the entire range are designated. The following S1
At 10, the designated range average value calculation processing described above with reference to FIG. 3 is called. Then, in the next S120, the arithmetic mean γ obtained in the designated range average value calculation processing is set as the reference value.

【0061】ここでS100〜S120の処理を図4を
用いて具体的に説明する。上述したように画像メモリ2
0の多値データ記憶領域20aに記憶された多値データ
は、「0」〜「255」の階調値を有する画素のデータ
である。図4は、ある多値データについての階調値とそ
の階調値を有する画素の分布を示した説明図である。
Here, the processing of S100 to S120 will be specifically described with reference to FIG. Image memory 2 as described above
The multi-valued data stored in the 0-valued multi-value data storage area 20a is data of pixels having gradation values of “0” to “255”. FIG. 4 is an explanatory diagram showing gradation values of certain multi-value data and distribution of pixels having the gradation values.

【0062】S100にて全範囲の階調値「0」〜「2
55」が指定され、S110にて指定範囲平均値算出処
理がコールされると、指定範囲平均値算出処理におい
て、まず指定範囲の階調値「0」〜「255」を有する
画素の中で相対的に小さな階調値を有する10%の画素
が選択される(S300)。図4(a)では、階調値
「0」〜「α」の範囲に分布する画素が相対的に小さな
10%の画素に相当する。そして、これらの画素の有す
る最大の階調値が下方階調値とされる(S310)。す
なわち、下方階調値は、階調値「α」である。
At S100, the gradation values "0" to "2"
When “55” is designated and the designated range average value calculation process is called in S110, in the designated range average value calculation process, first, the relative range among the pixels having the gradation values “0” to “255” in the designated range is used. 10% of pixels having an extremely small gradation value are selected (S300). In FIG. 4A, pixels distributed in the range of gradation values “0” to “α” correspond to relatively small pixels of 10%. Then, the maximum gradation value of these pixels is set as the lower gradation value (S310). That is, the lower gradation value is the gradation value “α”.

【0063】続いて、指定範囲の階調値「0」〜「25
5」を有する画素の中で相対的に大きな階調値を有する
10%の画素が選択される(S320)。図4では、階
調値「β」〜「255」の範囲に分布する画素が相対的
に大きな10%の画素に相当する。そして、これらの画
素の有する最小の階調値が上方階調値とされる。すなわ
ち、上方階調値は、階調値「β」である。
Subsequently, the gradation values "0" to "25" in the designated range are set.
5% of the pixels having a relatively large gradation value among the pixels having "5" are selected (S320). In FIG. 4, the pixels distributed in the range of the gradation values “β” to “255” correspond to relatively large 10% of the pixels. Then, the minimum gradation value of these pixels is set as the upper gradation value. That is, the upper gradation value is the gradation value “β”.

【0064】そして、下方階調値αと上方階調値βとの
相加平均γが求められる(S340)。上述したS12
0では、この相加平均γが基準値とされる。続くS13
0では、基準値以下の階調値を指定し、次のS140で
指定範囲平均値算出処理をコールする。そして、指定範
囲平均値算出処理にて求められた相加平均を暗側平均値
とする。
Then, an arithmetic mean γ of the lower gradation value α and the upper gradation value β is obtained (S340). S12 described above
At 0, this arithmetic mean γ is used as a reference value. Following S13
In the case of 0, a gradation value equal to or less than the reference value is designated, and in the next S140, the designated range average value calculation processing is called. Then, the arithmetic mean obtained in the designated range average value calculation processing is set as a dark side average value.

【0065】また、次のS160では、基準値以上の階
調値を指定し、次のS170で指定範囲平均値算出処理
をコールする。そして、指定範囲平均値算出処理にて求
められた相加平均を明側平均値とする。そして、続くS
190では、暗側平均値と明側平均値の相加平均を境界
値として算出する。
In the next step S160, a gradation value equal to or larger than the reference value is designated, and in the next step S170, the designated range average value calculation processing is called. Then, the arithmetic mean obtained in the designated range average value calculation processing is set as the light side average value. And the following S
At 190, the arithmetic mean of the dark side average value and the light side average value is calculated as a boundary value.

【0066】ここでS130〜S190の処理を図4を
用いて具体的に説明する。基準値以下の階調値「0」〜
「γ」が指定され(S130)指定範囲平均値算出処理
が実行されると(S140)、図4(b)に示すよう
に、下方階調値a1及び上方階調値b1が算出され、相
加平均c1が算出される。そして、相加平均c1が暗側
平均値となる(S150)。また、基準値以上の階調値
「γ」〜「255」が指定され(S160)範囲平均値
算出処理が実行されると(S170)、図4(b)に示
すように、下方階調値a2及び上方階調値b2が算出さ
れ、相加平均c2が算出される。そして、この相加平均
c2が明側平均値となる(S180)。そして、暗側平
均値c1と明側平均値c2の相加平均γ’が境界値とし
て算出される(S190)。
Here, the processing of S130 to S190 will be specifically described with reference to FIG. Gradation value "0" to below the reference value
When “γ” is designated (S130) and the designated range average value calculation process is executed (S140), as shown in FIG. 4B, the lower gradation value a1 and the upper gradation value b1 are calculated, and the phase is calculated. The weighted average c1 is calculated. Then, the arithmetic mean c1 becomes the dark side average value (S150). Further, when the gradation values “γ” to “255” which are equal to or larger than the reference value are designated (S160), and the range average value calculation processing is executed (S170), as shown in FIG. a2 and an upper gradation value b2 are calculated, and an arithmetic mean c2 is calculated. Then, the arithmetic mean c2 becomes a light-side average value (S180). Then, the arithmetic mean γ ′ of the dark side average value c1 and the light side average value c2 is calculated as a boundary value (S190).

【0067】図2中のS200では、境界値γ’と基準
値γとの差が所定値ε以下であるか否かを判断する。こ
こで|γ’−γ|≦εである場合(S200:YE
S)、S210にて境界値γ’を閾値とし、その後、本
閾値決定処理を終了する。一方、|γ’−γ|>εであ
る場合(S200:NO)、S220にて境界値γ’を
新たな基準値γとしてS130からの処理を繰り返す。
In S200 in FIG. 2, it is determined whether or not the difference between the boundary value γ ′ and the reference value γ is equal to or smaller than a predetermined value ε. Here, when | γ′−γ | ≦ ε (S200: YE
S), the threshold value is set to the boundary value γ ′ in S210, and then the threshold value determination processing ends. On the other hand, if | γ′−γ |> ε (S200: NO), the process from S130 is repeated with the boundary value γ ′ as a new reference value γ in S220.

【0068】S130〜S190の処理が繰り返される
と、暗側平均値は、「暗」に相当する画素の分布の平均
階調値に近づき、一方、明側平均値は、「明」に相当す
る画素の分布の平均階調値に近づく。したがって、境界
値γ’は、ある階調値にしだいに収束していく。
When the processing of S130 to S190 is repeated, the dark side average value approaches the average gradation value of the distribution of pixels corresponding to “dark”, while the light side average value corresponds to “bright”. It approaches the average gradation value of the pixel distribution. Therefore, the boundary value γ ′ gradually converges to a certain gradation value.

【0069】従来、全画素の中の暗い側10%、明るい
側10%が含まれるような階調値を求めて、その相加平
均を閾値とする手法があった。しかし、画像中の情報コ
ードの占める面積が極端に小さくなった場合、すなわち
暗い側の画素が明るい側の画素に比べて極端に少なくな
ると、図11(b)に示すように、算出される閾値γ2
が階調値の高い側(明るい側)にずれて、その結果、
「明」に相当する画素(図11(b)中に記号Aで示し
た)が「暗」として2値化されるという不都合が生じて
いた。
Conventionally, there has been a method in which a gradation value that includes 10% of the dark side and 10% of the bright side in all the pixels is obtained, and the arithmetic mean thereof is used as a threshold value. However, when the area occupied by the information code in the image becomes extremely small, that is, when the number of pixels on the dark side becomes extremely small as compared with the number of pixels on the light side, the calculated threshold is calculated as shown in FIG. γ2
Shifts to the higher (brighter) side of the tone value,
The pixel corresponding to "bright" (indicated by symbol A in FIG. 11B) is inconveniently binarized as "dark".

【0070】これに対して、本第1実施形態では、基準
値以下の階調値を指定して(図2中のS130)指定範
囲平均値算出処理を実行することによって(S14
0)、「暗」側の画素の平均階調値(暗側平均値)を求
め(S150)、基準値以上の階調値を指定して(S1
60)指定範囲平均値算出処理を実行することによって
(S170)、「明」側の画素の平均階調値(明側平均
値)を求めて(S180)、その相加平均を新たな境界
値(基準値)とする(S220)という処理を繰り返し
て閾値を決定する(S210)。すなわち、「暗」側の
画素と「明」側の画素とを分け、ぞれぞれの平均の階調
値を求めて閾値を求めるようにしたため、「暗」側の画
素と「明」側の画素の個数が極端に違っていても、
「暗」に相当する画素と「明」に相当する画素を適切に
切り分けるような閾値を決定することができる。その結
果、取り込んだ画像中の2次元コード領域と背景領域と
の面積比が変化しても、適切に多値データを2値化する
ことができる。
On the other hand, in the first embodiment, by specifying a gradation value equal to or smaller than the reference value (S130 in FIG. 2), the designated range average value is calculated (S14).
0), the average tone value (dark-side average value) of pixels on the “dark” side is obtained (S150), and a tone value equal to or higher than the reference value is designated (S1)
60) By executing a designated range average value calculation process (S170), an average gradation value (bright side average value) of pixels on the “bright” side is obtained (S180), and the arithmetic mean thereof is calculated as a new boundary value. The process of setting (reference value) (S220) is repeated to determine the threshold value (S210). In other words, the pixels on the “dark” side and the pixels on the “bright” side are separated, and the threshold value is calculated by calculating the average tone value of each. Even if the number of pixels is extremely different,
It is possible to determine a threshold value that appropriately separates a pixel corresponding to “dark” from a pixel corresponding to “bright”. As a result, even if the area ratio between the two-dimensional code area and the background area in the captured image changes, the multi-value data can be appropriately binarized.

【0071】また、図3に示した指定範囲平均値算出処
理では、「暗」又は「明」側の画素の平均階調値を求め
るにあたって、対象となる画素のうちで階調値の低い側
と高い側の所定割合の画素を含む境界の階調値(下方階
調値、上方階調値)を算出して(図3中のS310,S
330)、「暗」又は「明」側の画素の平均階調値を求
める(S340)。したがって、「暗」又は「明」に対
応する画素の分布に最頻値が存在しない場合であっても
適切に閾値を決定することができる。 [第2実施形態]上記第1実施形態は、全画素を「暗」
側の画素と「明」側の画素の2つに分け、それぞれ
「暗」側の画素の分布の平均値及び「明」側の画素の分
布の平均値から閾値を決定するものであった。
In the designated range average value calculation processing shown in FIG. 3, when calculating the average gradation value of the pixels on the “dark” or “bright” side, the lower gradation value of the target pixels is used. And the gradation value (lower gradation value, upper gradation value) of the boundary including a predetermined percentage of pixels on the higher side is calculated (S310, S310 in FIG. 3).
330), an average gradation value of pixels on the “dark” or “bright” side is obtained (S340). Therefore, even when the mode does not exist in the distribution of the pixels corresponding to “dark” or “bright”, the threshold can be appropriately determined. [Second Embodiment] In the first embodiment, all the pixels are “dark”.
The threshold value is determined from the average value of the distribution of the pixels on the “dark” side and the average value of the distribution of the pixels on the “bright” side.

【0072】これに対して、閾値として決定すべき階調
値近傍の画素の個数は、その階調値の前後の適当な範囲
において等しくなるはずである。図4(a)からも分か
るように、「暗」に相当する画素の分布と「明」に相当
する画素の分布の間の範囲では画素の分布が平坦になっ
ているからである。この前提に基づいて閾値を決定する
実施形態を第2実施形態として以下に説明する。なお、
上記第1実施形態と同様の部分については、説明を省略
し、同一の符号を付して記述する。ここでは、上記第1
実施形態と異なる閾値決定処理についてのみ説明する。
On the other hand, the number of pixels near the gradation value to be determined as the threshold value should be equal in an appropriate range before and after the gradation value. As can be seen from FIG. 4A, the distribution of pixels is flat in the range between the distribution of pixels corresponding to “dark” and the distribution of pixels corresponding to “bright”. An embodiment in which the threshold is determined based on this premise will be described below as a second embodiment. In addition,
The description of the same parts as those in the first embodiment will be omitted, and the same reference numerals will be given. Here, the first
Only the threshold value determination processing different from the embodiment will be described.

【0073】図5は、本第2実施形態において、読取制
御回路10にて実行される閾値決定処理を示すフローチ
ャートである。まず最初のステップS400において、
全範囲の階調値「0」〜「255」を指定する。続くS
410にて、上記第1実施形態で図3を用いて上述した
指定範囲平均値算出処理をコールする。これによって、
上記第1実施形態と同様に例えば図4(a)に示すよう
な、下方階調値αと上方階調値βとの相加平均γが求め
られる。続くS420では、S410にて求められた平
均値γを基準値とする。
FIG. 5 is a flowchart showing a threshold value determining process executed by the reading control circuit 10 in the second embodiment. First, in the first step S400,
The gradation values “0” to “255” of the entire range are designated. The following S
At 410, the designated range average value calculation processing described above with reference to FIG. 3 in the first embodiment is called. by this,
As in the first embodiment, an arithmetic mean γ of the lower gradation value α and the upper gradation value β as shown in FIG. In subsequent S420, the average value γ obtained in S410 is set as a reference value.

【0074】そして、続くS430では、基準値γ以下
の階調値aであって、階調値「a」〜「γ」までの範囲
の画素が所定個数Kとなるような「下側階調値」として
の階調値「a」を求める。同様に、次にS440では、
基準値γ以上の階調値bであって、階調値「γ」〜
「b」までの範囲の画素が所定個数Kとなるような「上
側階調値」としての階調値「b」を求める。
Then, in S430, the “lower gradation value” is set so that the number of pixels having the gradation value “a” equal to or smaller than the reference value γ and in the range of gradation values “a” to “γ” is a predetermined number K. The tone value “a” as the “value” is obtained. Similarly, next in S440,
A gradation value b equal to or more than the reference value γ, and the gradation value “γ”
A gradation value “b” as an “upper gradation value” such that a predetermined number K of pixels in a range up to “b” is obtained.

【0075】続くS450では、上側階調値aと下側階
調値bの相加平均を境界値γ’として算出する。なお、
上述したS430〜S450の処理が「平均値算出処
理」に相当する。ここでS430〜S450の処理を、
図6を参照して具体的に説明する。
In S450, the arithmetic mean of the upper gradation value a and the lower gradation value b is calculated as the boundary value γ '. In addition,
The processing of S430 to S450 described above corresponds to “average value calculation processing”. Here, the processing of S430 to S450 is
A specific description will be given with reference to FIG.

【0076】例えば図6は、図4(a)に示した階調値
γ付近の画素の個数と階調値との対応関係を拡大して示
した説明図である。図6中の階調値γは、図4(a)の
階調値γに対応している。この図6において、階調値γ
>aであって、階調値「a」〜「γ」の範囲(図6中に
記号Dで示した範囲)に分布する画素が所定個数Kとな
るような階調値「a」を求める(S430)。所定個数
Kは、図6中の分布曲線の範囲Dにおける下側の面積に
相当する。一方、階調値γ<bであって、階調値「γ」
〜「b」の範囲(図6中に記号Cで示した範囲)の画素
が所定個数Kとなるような階調値「b」を求める(S4
40)。所定個数Kは、図6中の分布曲線の範囲Cにお
ける下側の面積に相当する。そして、階調値aと階調値
bの相加平均を境界値γ’として算出する(S45
0)。
For example, FIG. 6 is an explanatory diagram in which the correspondence between the number of pixels near the tone value γ shown in FIG. 4A and the tone value is enlarged. The tone value γ in FIG. 6 corresponds to the tone value γ in FIG. In FIG. 6, the gradation value γ
> A, and a predetermined number K of pixels distributed in a range of gradation values “a” to “γ” (a range indicated by a symbol D in FIG. 6) is obtained. (S430). The predetermined number K corresponds to the lower area in the range D of the distribution curve in FIG. On the other hand, when the gradation value γ <b, the gradation value “γ”
The gradation value “b” is calculated so that the number of pixels in the range of “−b” (the range indicated by the symbol C in FIG. 6) is a predetermined number K (S4).
40). The predetermined number K corresponds to the lower area in the range C of the distribution curve in FIG. Then, the arithmetic mean of the gradation value a and the gradation value b is calculated as the boundary value γ ′ (S45).
0).

【0077】そして、図5中のS460では、境界値
γ’と基準値γとの差が所定値ε以下であるか否かを判
断する。ここで|γ’−γ|≦εである場合(S46
0:YES)、S470にて境界値γ’を閾値とし、そ
の後、本閾値決定処理を終了する。一方、|γ’−γ|
>εである場合(S460:NO)、S480にて境界
値γ’を新たな基準値γとしてS430からの処理を繰
り返す。
Then, in S460 in FIG. 5, it is determined whether or not the difference between the boundary value γ ′ and the reference value γ is equal to or smaller than a predetermined value ε. Here, when | γ′−γ | ≦ ε (S46
0: YES), the boundary value γ 'is set as a threshold value in S470, and the threshold value determination processing is thereafter terminated. On the other hand, | γ'-γ |
If> ε (S460: NO), the process from S430 is repeated in S480 using the boundary value γ ′ as a new reference value γ.

【0078】S430〜S450の処理を繰り返せば、
階調値に対する画素の個数の分布が境界値γ’の前後の
適当な範囲で一定となるまで境界値γ’は移動すること
になる。図4では、境界値γ’は、基準値γよりも左方
向(「暗」側の画素方向)へ移動して収束する。
By repeating the processing from S430 to S450,
The boundary value γ ′ moves until the distribution of the number of pixels with respect to the gradation value becomes constant in an appropriate range before and after the boundary value γ ′. In FIG. 4, the boundary value γ ′ moves to the left (pixel direction on the “dark” side) from the reference value γ and converges.

【0079】本第2実施形態では、「暗」に相当する画
素の分布と「明」に相当する画素の分布との境界部分
は、画素の分布が一定となっていることに着目し、境界
値近傍の画素の分布に従い閾値を決定する。これによっ
て、「暗」の側の画素と「明」の側の画素の個数が極端
に違っていても、「暗」に相当する画素と「明」に相当
する画素を適切に切り分けるような閾値を決定すること
ができる。その結果、取り込んだ画像中の2次元コード
領域と背景領域との面積比が変化しても、適切に多値デ
ータを2値化することができる。
In the second embodiment, the boundary between the distribution of pixels corresponding to “dark” and the distribution of pixels corresponding to “bright” is focused on the fact that the distribution of pixels is constant. The threshold is determined according to the distribution of the pixels near the value. With this, even if the number of pixels on the “dark” side and the number of pixels on the “bright” side are extremely different, a threshold value that appropriately separates pixels corresponding to “dark” and pixels corresponding to “bright” can be obtained. Can be determined. As a result, even if the area ratio between the two-dimensional code area and the background area in the captured image changes, the multi-value data can be appropriately binarized.

【0080】また、階調値付近の画素の分布に従って閾
値を決定するため、「暗」又は「明」側の画素の分布に
最頻値が存在しない場合であっても適切に閾値を決定す
ることができる。 [第3実施形態]上記第1実施形態においては、全画素
を「暗」側の画素と「明」側の画素に分けることによっ
て、また、上記第2実施形態においては、境界値付近の
画素の分布に着目して、適切な閾値を決定するものであ
った。つまり、画素の全体の分布には、「暗」側の画素
の分布と「明」側の画素の分布のみが存在することを前
提としていた。しかし、例えば情報コードが印刷されて
いる情報記録面に情報コードに重ねて図柄が印刷されて
いるような場合も考えられる。この図柄は、例えば薄い
青色などで印刷されていることが考えられ、その場合、
この図柄部分に対応する画素は、「明」に相当する画素
と「暗」に相当する画素の中間あたりの階調値を持つこ
とが考えられる。例えば図8(b)に記号Bで示すよう
に、「暗」に相当する画素の分布と「明」に相当する画
素の分布の間に、この図柄部分に対応する画素の分布が
現れるという具合である。
Further, since the threshold value is determined in accordance with the distribution of pixels in the vicinity of the gradation value, the threshold value is determined appropriately even when the mode value does not exist in the distribution of pixels on the “dark” or “bright” side. be able to. [Third Embodiment] In the first embodiment, all pixels are divided into "dark" pixels and "bright" pixels. In the second embodiment, pixels near the boundary value are divided. The appropriate threshold value is determined by paying attention to the distribution of. In other words, it is assumed that only the distribution of pixels on the “dark” side and the distribution of pixels on the “bright” side exist in the overall distribution of pixels. However, for example, a case may be considered in which a symbol is printed on the information recording surface on which the information code is printed so as to overlap the information code. This design may be printed in light blue, for example, in which case,
It is conceivable that the pixel corresponding to the symbol portion has a gradation value around the middle of the pixel corresponding to “bright” and the pixel corresponding to “dark”. For example, as shown by a symbol B in FIG. 8B, the distribution of the pixels corresponding to the symbol part appears between the distribution of the pixels corresponding to “dark” and the distribution of the pixels corresponding to “bright”. It is.

【0081】そして、この図柄の部分は、情報コードと
切り分けるために「明」として2値化したいのである
が、上記第1実施形態に示した方法によれば、図柄部分
を含む画素の分布が「暗」側の画素と見なされることも
考えられる。この場合、この図柄に対応する画素は、
「暗」として2値化される可能性がある。また、上記第
2実施形態に示した方法によれば、図8(b)から分か
るように、「明」に相当する画素の分布と、図柄部分に
相当する画素の分布との境界部分に閾値が決定される可
能性がある。そのため、この場合も、図柄に対応する画
素は「暗」として2値化される可能性がある。
It is desired to binarize this symbol portion as “bright” in order to separate it from the information code. According to the method described in the first embodiment, the distribution of pixels including the symbol portion is reduced. It is also conceivable that the pixel is regarded as a “dark” side pixel. In this case, the pixel corresponding to this symbol is
It may be binarized as “dark”. According to the method described in the second embodiment, as can be seen from FIG. 8B, the threshold value is set at the boundary between the distribution of pixels corresponding to “bright” and the distribution of pixels corresponding to the design portion. May be determined. Therefore, also in this case, the pixel corresponding to the symbol may be binarized as “dark”.

【0082】本第3実施形態の2次元コード読取装置1
は、このように情報コードの記録面に情報コードに重ね
て図柄が印刷されている場合であっても、適切な閾値を
決定して情報コードを2値化する。なお、上記第1及び
第2実施形態と同様の部分については説明を省略し、同
一の符号を用いて記述する。ここでは、上記第1及び第
2実施形態の閾値決定処理及びその後の2値化処理に相
当する2値化処理についてのみ説明する。
The two-dimensional code reader 1 of the third embodiment
Determines the appropriate threshold value and binarizes the information code even when the symbol is printed on the recording surface of the information code so as to overlap the information code. The description of the same parts as those in the first and second embodiments will be omitted, and the description will be made using the same reference numerals. Here, only the threshold value determination processing of the first and second embodiments and the subsequent binarization processing corresponding to the binarization processing will be described.

【0083】図7は、本第3実施形態における2値化処
理を示すフローチャートである。まず最初のステップS
500において、取り込んだ多値画像データを小エリア
に分割する。本第3実施形態において一の小エリアは3
×3画素となっている。続くS510では、各小エリア
に含まれる画素の最大階調値、最小階調値、及びその差
を算出する。
FIG. 7 is a flowchart showing the binarization processing in the third embodiment. First step S
At 500, the captured multi-valued image data is divided into small areas. In the third embodiment, one small area is 3
× 3 pixels. In subsequent S510, the maximum gradation value and the minimum gradation value of the pixels included in each small area and the difference between them are calculated.

【0084】次のS520では、小エリア縦横3つ分の
基準エリアを選択し、この基準エリアを単位として、こ
の基準エリアに含まれる小エリアの最大階調値の相加平
均h2を求める。そして、続くS530では、各小エリ
アの最大階調値と最小階調値との差の分布をとる。続く
S540では、差の分布において、相対的に差が大きい
方の分布の平均値d2を算出する。
In the next S520, a reference area for three small areas in the vertical and horizontal directions is selected, and the arithmetic mean h2 of the maximum gradation value of the small area included in the reference area is determined using the reference area as a unit. Then, in S530, the distribution of the difference between the maximum gradation value and the minimum gradation value of each small area is obtained. In S540, the average value d2 of the distribution having a relatively large difference in the difference distribution is calculated.

【0085】次のS550では、S520にて算出した
平均値h2からd2の(3/4)倍を引いた値を閾値と
して算出する。そして、S560では、選択した基準エ
リアの各小エリアに含まれる画素を、S550にて算出
された閾値を用いて2値化する。
At S550, a value obtained by subtracting (3/4) times d2 from the average value h2 calculated at S520 is calculated as a threshold value. Then, in S560, the pixels included in each small area of the selected reference area are binarized using the threshold calculated in S550.

【0086】続くS570では、全てのエリアを2値化
したか否かを判断する。ここで2値化していないエリア
が存在する場合(S570:NO)、S520からの処
理を繰り返す。一方、全てのエリアを2値化したと判断
された場合(S570:YES)、本2値化処理を終了
する。
At S570, it is determined whether all the areas have been binarized. Here, when there is an area that has not been binarized (S570: NO), the processing from S520 is repeated. On the other hand, when it is determined that all the areas have been binarized (S570: YES), the binarization processing ends.

【0087】ここで上述した本第3実施形態における2
値化処理を、図8を用いて具体的に説明する。上述した
ように、画像データ全体を、所定数の画素を含む小エリ
アに分割し(図7中のS500)、当該小エリアに含ま
れる画素の最大の階調値、最小の階調値、及びその差を
算出する(S510)。つまり、画像データ全体を、図
8(a)に示すように、小エリアe1,e2,e3,・
・・に分割する。そして、各小エリアe1,e2,e
3,・・・のそれぞれに含まれる画素の有する最大の階
調値と最小の階調値とを求め、さらに、その差を算出す
る。図8(a)に示した小エリアe8,e9は、情報コ
ードの一部がそのエリア内の一部にあるため、最大階調
値と最小階調値との差は大きくなる。一方、小エリアe
1〜e7では、中間調の図柄部分に対応する画素と
「明」の画素の階調値の差となるため、小エリアe8,
e9に比べて、最大階調値と最小階調値との差は小さく
なる。
Here, 2 in the third embodiment described above.
The value conversion process will be specifically described with reference to FIG. As described above, the entire image data is divided into small areas including a predetermined number of pixels (S500 in FIG. 7), and the maximum gradation value, the minimum gradation value, and the minimum gradation value of the pixels included in the small area are determined. The difference is calculated (S510). That is, as shown in FIG. 8A, the entire image data is divided into small areas e1, e2, e3,.
· Divide into And each small area e1, e2, e
The maximum gradation value and the minimum gradation value of the pixel included in each of 3,... Are obtained, and the difference is calculated. In the small areas e8 and e9 shown in FIG. 8A, the difference between the maximum gradation value and the minimum gradation value is large because a part of the information code is in a part of the area. On the other hand, small area e
In the case of 1 to e7, the difference between the tone value of the pixel corresponding to the halftone pattern portion and the tone value of the "bright" pixel is obtained.
The difference between the maximum gradation value and the minimum gradation value is smaller than in e9.

【0088】次に所定数の小エリアにて構成される基準
エリアを単位として、当該基準エリアに含まれる小エリ
アの最大の階調値の相加平均を求める(S520)。こ
の基準エリアは、縦横3つの小エリアから構成される。
図8(a)に示す如く、全エリアを6つの基準エリアに
分ける。例えば小エリアe1〜e9の9つが基準エリア
を構成するという具合である。そして、この基準エリア
にに含まれる小エリアの最大の階調値の相加平均を求め
る。なお、基準エリアとしては、例えば画像データの全
エリアを考えてもよいが、後述するようにこの基準エリ
ア単位で閾値が決定されるため、画像データをいくつか
の基準エリアに分けた方が適切な閾値が決定されるとい
う点で有利である。
Next, the arithmetic mean of the maximum gradation value of the small area included in the reference area is determined in units of a reference area composed of a predetermined number of small areas (S520). This reference area is composed of three vertical and horizontal small areas.
As shown in FIG. 8A, the entire area is divided into six reference areas. For example, nine small areas e1 to e9 constitute a reference area. Then, the arithmetic mean of the maximum gradation value of the small area included in the reference area is obtained. The reference area may be, for example, the entire area of the image data. However, since the threshold is determined in units of the reference area as described later, it is more appropriate to divide the image data into several reference areas. This is advantageous in that a suitable threshold is determined.

【0089】基準エリアに対する画素の分布が図8
(b)のようになるのであれば、最大の階調値の平均
は、おおよそ「明」に対応する画素の分布の最頻値辺り
に算出される(記号h2で示した)。次に小エリア毎に
算出された差の分布に基づいて、差が大きい側に分布す
る小エリアについて当該差の平均を求める。差の分布は
図9に示す如くである。上述したように、小エリアe1
〜e7に対して算出される差は、相対的に小さくなるた
め、これらのエリアについては、階調差の小さい側に分
布する。一方、小エリアe8,e9に対して算出される
差は、相対的に大きくなるため、これらのエリアについ
ては、階調差の大きい側に分布する。したがって、図9
に示す如く、全領域での階調値の差の分布を見れば、階
調値の差が相対的に大きな小エリアに対応する部分と、
階調値の差が相対的に小さな小エリアに対応する部分が
現れる。
FIG. 8 shows the distribution of pixels with respect to the reference area.
In the case of (b), the average of the maximum gradation value is calculated around the mode of the distribution of pixels corresponding to “bright” (indicated by the symbol h2). Next, based on the distribution of the difference calculated for each small area, an average of the differences is obtained for the small areas distributed on the side where the difference is large. The distribution of the difference is as shown in FIG. As described above, the small area e1
Since the difference calculated for .about.e7 becomes relatively small, these areas are distributed on the side where the gradation difference is small. On the other hand, since the difference calculated for the small areas e8 and e9 is relatively large, these areas are distributed on the side where the gradation difference is large. Therefore, FIG.
As can be seen from the distribution of tone value differences in the entire region, as shown in FIG.
A portion corresponding to a small area having a relatively small difference in tone value appears.

【0090】そこで、階調差が大きい側の分布の平均の
階調差を算出する(S540)。すなわち、図9中にお
ける平均値d2を算出する。この平均値d2は、図8
(b)中のd2におおよそ対応するものである。続けて
最大の階調値の相加平均h2を差の分布の平均値d2に
て補正して閾値を決定する。本実施形態では、相加平均
h2からd2の(3/4)倍を引いた値を閾値としてい
る。
Therefore, the average gradation difference of the distribution having the larger gradation difference is calculated (S540). That is, the average value d2 in FIG. 9 is calculated. This average value d2 is shown in FIG.
It roughly corresponds to d2 in (b). Subsequently, the arithmetic mean h2 of the maximum gradation value is corrected by the average value d2 of the difference distribution to determine the threshold value. In the present embodiment, a value obtained by subtracting (3/4) times d2 from the arithmetic mean h2 is used as the threshold.

【0091】つまり、本第3実施形態における方法は、
「暗」に相当する画素の分布と、「明」に相当する画素
の分布との差を求め、この差に応じて閾値を決定する。
これによって、図8(b)に示すように、中間調である
図柄部分に相当する画素の分布を考慮して閾値を決定す
ることができる。その結果、図柄と重ねて印刷されてい
る情報コードであっても、適切な閾値を設定することが
できる。
That is, the method in the third embodiment is as follows:
The difference between the distribution of pixels corresponding to “dark” and the distribution of pixels corresponding to “bright” is obtained, and a threshold is determined according to the difference.
As a result, as shown in FIG. 8B, the threshold value can be determined in consideration of the distribution of pixels corresponding to a design portion that is a halftone. As a result, an appropriate threshold value can be set even for an information code printed over a symbol.

【0092】なお、本第3実施形態においては、小エリ
ア縦横3つ分の基準エリアを選択し、この基準エリアを
単位として、この基準エリアに含まれる小エリアの最大
階調値の相加平均h2を求め(図7中のS520)、相
加平均h2からd2の(3/4)倍を引いた値を閾値と
して決定したが(S550)、図8(b)に示したよう
に、基準エリアに含まれる小エリアの最小階調値の相加
平均h1を求め、この相加平均h1に差の平均d2の
(1/4)倍を足した値を閾値として決定してもよい。 [その他]以上、本発明はこのような上記実施形態に何
等限定されるものではなく、本発明の主旨を逸脱しない
範囲において種々なる形態で実施し得る。
In the third embodiment, a reference area of three small areas in the vertical and horizontal directions is selected, and the arithmetic mean of the maximum gradation values of the small areas included in the reference area is selected in units of the reference area. h2 is obtained (S520 in FIG. 7), and a value obtained by subtracting (3/4) times d2 from the arithmetic mean h2 is determined as a threshold value (S550). As shown in FIG. The arithmetic mean h1 of the minimum gradation values of the small areas included in the area may be obtained, and a value obtained by adding (1 /) times the average d2 of the difference to the arithmetic mean h1 may be determined as the threshold. [Others] As described above, the present invention is not limited to the above embodiment at all, and can be implemented in various forms without departing from the gist of the present invention.

【0093】例えば上記第1、第2及び第3実施形態で
は、本発明を2次元コード読取装置に適用したものであ
ったが、例えばバーコードを読み取るバーコード読取装
置に適用することももちろん可能である。また、情報コ
ードの品質判断をするための装置に適用し、読取対象の
情報コードを画像データとして復元するコード品質判断
補助装置を構成することも考えられる。このコード品質
判断補助装置にて復元された画像データに基づいて、印
刷された情報コードの印刷品質等を評価すれば、画像デ
ータ中の背景領域の大きさに関係なく、情報コードの品
質を適切に判断することができる。
For example, in the first, second, and third embodiments, the present invention is applied to a two-dimensional code reader. However, it is of course possible to apply the present invention to a bar code reader for reading a bar code. It is. It is also conceivable that the present invention is applied to an apparatus for judging the quality of an information code and constitutes a code quality judgment assisting apparatus for restoring the information code to be read as image data. If the print quality of the printed information code is evaluated based on the image data restored by the code quality determination assisting device, the quality of the information code can be appropriately adjusted regardless of the size of the background area in the image data. Can be determined.

【図面の簡単な説明】[Brief description of the drawings]

【図1】実施形態の2次元コード読取装置を示すブロッ
ク図である。
FIG. 1 is a block diagram illustrating a two-dimensional code reader according to an embodiment.

【図2】第1実施形態の閾値決定処理を示すフローチャ
ートである。
FIG. 2 is a flowchart illustrating a threshold value determination process according to the first embodiment.

【図3】第1及び第2実施形態の指定範囲平均値算出処
理を示すフローチャートである。
FIG. 3 is a flowchart illustrating a designated range average value calculation process according to the first and second embodiments.

【図4】閾値決定処理を具体的に示す説明図である。FIG. 4 is an explanatory diagram specifically showing a threshold value determination process.

【図5】第2実施形態の閾値決定処理を示すフローチャ
ートである。
FIG. 5 is a flowchart illustrating a threshold value determination process according to the second embodiment.

【図6】閾値決定処理を具体的に示す説明図である。FIG. 6 is an explanatory diagram specifically showing a threshold value determination process.

【図7】第3実施形態の2値化処理を示すフローチャー
トである。
FIG. 7 is a flowchart illustrating a binarization process according to a third embodiment.

【図8】2値化処理における閾値決定処理を示すフロー
チャートである。
FIG. 8 is a flowchart illustrating a threshold value determination process in the binarization process.

【図9】小エリアにおける階調差の分布を示す説明図で
ある。
FIG. 9 is an explanatory diagram showing a distribution of a gradation difference in a small area.

【図10】画像中の2次元コード領域と背景領域との関
係を示す説明図である。
FIG. 10 is an explanatory diagram showing a relationship between a two-dimensional code area and a background area in an image.

【図11】従来の問題点を示すための説明図である。FIG. 11 is an explanatory diagram showing a conventional problem.

【符号の説明】[Explanation of symbols]

1…2次元コード読取装置 10…読取
制御回路 11…照明用発光ダイオード(照明LED) 12…C
CDエリアセンサ 13…増幅回路 14…A
/D変換回路 15…アドレス発生回路 16…同
期パルス発生回路 20…画像メモリ 20a…
多値データ記憶領域 20b…2値データ記憶領域 30…シ
ステム制御回路 31…スイッチ群 32…液
晶表示器 33…通信I/F回路
DESCRIPTION OF SYMBOLS 1 ... Two-dimensional code reader 10 ... Read control circuit 11 ... Lighting diode for illumination (illumination LED) 12 ... C
CD area sensor 13 ... Amplifier circuit 14 ... A
/ D conversion circuit 15 ... address generation circuit 16 ... synchronization pulse generation circuit 20 ... image memory 20a ...
Multi-value data storage area 20b Binary data storage area 30 System control circuit 31 Switch group 32 Liquid crystal display 33 Communication I / F circuit

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】読取対象の画像を光学的に検出し、当該検
出された画像に対応するアナログ画像信号をA/D変換
することによって、前記画像を構成する各画素が信号レ
ベルに応じた階調値を有する多値データに変換して記憶
し、当該記憶された多値データを2値データに変換する
ための閾値を決定する閾値決定処理を行い、当該閾値決
定処理によって決定された閾値を用いて前記多値データ
を前記2値データに変換する情報コードの2値化方法に
おいて、 前記閾値決定処理は、 指定された範囲の階調値を有する画素の中の相対的に小
さな階調値を有する所定割合の画素の有する最大の階調
値である下方階調値と、指定された範囲の階調値を有す
る画素の中の相対的に大きな階調値を有する所定割合の
画素の有する最小の階調値である上方階調値とを求め、
前記下方階調値と前記上方階調値との相加平均を求める
指定範囲平均値算出処理を含んでおり、 次の手順(1)〜(4)によって実行されることを特徴
とする情報コードの2値化方法。 (1)全範囲の階調値を指定し、前記指定範囲平均値算
出処理にて算出される前記相加平均を基準値とする。 (2)前記基準値以下の階調値を指定し、前記指定範囲
平均値算出処理にて算出される前記相加平均を暗側平均
値とすると共に、前記基準値以上の階調値を指定し、前
記指定範囲平均値算出処理にて算出される前記相加平均
を明側平均値とする。 (3)前記暗側平均値と前記明側平均値との相加平均を
境界値として求める。 (4)前記境界値と前記基準値との差が予め定められた
値以下となっている場合には、前記境界値を前記閾値と
して決定する。一方、前記境界値と前記基準値との差が
予め定められた値よりも大きい場合には、前記境界値を
新たな基準値として、上記(2)からの手順を繰り返
す。
An image to be read is optically detected, and an analog image signal corresponding to the detected image is subjected to A / D conversion so that each pixel constituting the image has a floor corresponding to a signal level. Converts the stored multi-valued data into multi-valued data, stores the multi-valued data, performs a threshold value determining process for determining a threshold value for converting the stored multi-valued data into binary data, and calculates the threshold value determined by the threshold value determining process. In the method of binarizing an information code for converting the multi-valued data into the binary data by using the threshold value determining process, a relatively small gradation value among pixels having a gradation value in a specified range is used. The lower gradation value, which is the maximum gradation value of the predetermined ratio of pixels having a predetermined ratio, and the predetermined ratio of pixels having a relatively large gradation value among the pixels having the specified range of gradation values. Upper floor with minimum gradation value Seek and value,
An information code including a designated range average value calculation process for calculating an arithmetic mean of the lower gradation value and the upper gradation value, and executed by the following procedures (1) to (4): Binarization method. (1) A gradation value of the entire range is designated, and the arithmetic mean calculated in the designated range average value calculation processing is set as a reference value. (2) Specify a gradation value equal to or less than the reference value, specify the arithmetic mean calculated in the specified range average value calculation process as a dark side average value, and specify a gradation value equal to or more than the reference value. Then, the arithmetic mean calculated in the specified range average value calculation process is defined as a light side average value. (3) An arithmetic mean of the dark side average value and the light side average value is determined as a boundary value. (4) If the difference between the boundary value and the reference value is equal to or smaller than a predetermined value, the boundary value is determined as the threshold. On the other hand, when the difference between the boundary value and the reference value is larger than a predetermined value, the procedure from the above (2) is repeated using the boundary value as a new reference value.
【請求項2】読取対象の画像を光学的に検出し、当該検
出された画像に対応するアナログ画像信号をA/D変換
することによって、前記画像を構成する各画素が信号レ
ベルに応じた階調値を有する多値データに変換して記憶
し、当該記憶された多値データを2値データに変換する
ための閾値を決定する閾値決定処理を行い、当該閾値決
定処理によって決定された閾値を用いて前記多値データ
を前記2値データに変換する情報コードの2値化方法に
おいて、 前記閾値決定処理は、 指定された階調値よりも小さな階調値(下側階調値)で
あって、当該下側階調値から前記指定された階調値まで
の範囲に所定個数の画素が含まれるような下側階調値
と、指定された階調値よりも大きな階調値(上側階調
値)であって、前記指定された階調値から上側階調値ま
での範囲に所定個数の画素が含まれるような上側階調値
とを求め、前記下側階調値と前記上側階調値の相加平均
を求める平均値算出処理を含んでおり、 次の手順(1)〜(3)によって実行されることを特徴
とする情報コードの2値化方法。 (1)全画素のうちの相対的に小さな階調値を有する所
定割合の画素の有する最大の階調値である下方階調値
と、全画素のうちの相対的に大きな階調値を有する所定
割合の画素の有する最小の階調値である上方階調値とを
求めて、前記下方階調値と前記上方階調値との相加平均
を基準値として求める。 (2)前記基準値を指定し、前記平均値算出処理にて算
出される相加平均を境界値とする。 (3)前記境界値と前記基準値との差が予め定められた
値以下となっている場合には、前記境界値を前記閾値と
して決定する。一方、前記境界値と前記基準値との差が
予め定められた値よりも大きい場合には、前記境界値を
新たな基準値として、上記(2)からの手順を繰り返
す。
2. An image to be read is optically detected, and an analog image signal corresponding to the detected image is subjected to A / D conversion so that each pixel constituting the image has a floor corresponding to a signal level. Converts the stored multi-valued data into multi-valued data, stores the multi-valued data, performs a threshold value determining process for determining a threshold value for converting the stored multi-valued data into binary data, and calculates the threshold value determined by the threshold value determining process. In the binarization method of an information code for converting the multi-valued data into the binary data by using the threshold value determination process, the threshold value determination process is performed with a gradation value smaller than a designated gradation value (lower gradation value). Thus, a lower gradation value such that a predetermined number of pixels are included in the range from the lower gradation value to the designated gradation value, and a gradation value larger than the designated gradation value (upper side). Gradation value), which is higher than the specified gradation value. An average value calculating process for obtaining an upper grayscale value such that a predetermined number of pixels are included in a range up to the grayscale value, and calculating an arithmetic average of the lower grayscale value and the upper grayscale value. An information code binarization method, which is executed by the following procedures (1) to (3). (1) A lower gradation value which is a maximum gradation value of a predetermined percentage of pixels having a relatively small gradation value among all pixels, and a relatively large gradation value among all pixels An upper gradation value which is a minimum gradation value of a predetermined percentage of pixels is obtained, and an arithmetic average of the lower gradation value and the upper gradation value is obtained as a reference value. (2) The reference value is specified, and the arithmetic mean calculated in the average value calculation processing is set as a boundary value. (3) If the difference between the boundary value and the reference value is equal to or smaller than a predetermined value, the boundary value is determined as the threshold. On the other hand, when the difference between the boundary value and the reference value is larger than a predetermined value, the procedure from the above (2) is repeated using the boundary value as a new reference value.
【請求項3】請求項2に記載の2値化方法において、 前記平均値算出処理における前記所定個数は、前記境界
値と前記基準値との差に応じて決定されるよう構成され
ていることを特徴とする情報コードの2値化方法。
3. The binarization method according to claim 2, wherein the predetermined number in the average value calculation processing is determined according to a difference between the boundary value and the reference value. A binarization method for an information code, characterized in that:
【請求項4】読取対象の画像を光学的に検出し、当該検
出された画像に対応するアナログ画像信号をA/D変換
することによって、前記画像を構成する各画素が信号レ
ベルに応じた階調値を有する多値データに変換して記憶
し、当該記憶された多値データを2値データに変換する
ための閾値を決定する閾値決定処理を行い、当該閾値決
定処理によって決定された閾値を用いて前記多値データ
を前記2値データに変換する情報コードの2値化方法に
おいて、 前記閾値決定処理は、次の手順(1)〜(3)によって
実行されることを特徴とする情報コードの2値化方法。 (1)所定数の画素を含む小エリアに分割し、当該小エ
リアに含まれる画素の最大の階調値と最小の階調値との
差を算出する。 (2)前記階調値の差に対する前記小エリアの分布に基
づき、相対的に大きな差を有する前記小エリアの分布の
平均階調差を求めると共に、所定数の小エリアにて構成
される基準エリアを単位として、当該基準エリアに含ま
れる小エリアの最大又は最小の階調値の相加平均を求め
る。 (3)前記相加平均を前記平均階調差に基づき補正して
前記基準エリア毎に閾値を決定する。
4. An image to be read is optically detected, and an analog image signal corresponding to the detected image is subjected to A / D conversion so that each pixel constituting the image has a floor corresponding to a signal level. Converts the stored multi-valued data into multi-valued data, stores the multi-valued data, performs a threshold value determining process for determining a threshold value for converting the stored multi-valued data into binary data, and calculates the threshold value determined by the threshold value determining process. In the binarization method of an information code for converting the multi-valued data into the binary data using the information code, the threshold value determination processing is executed by the following procedures (1) to (3). Binarization method. (1) Divide into small areas including a predetermined number of pixels, and calculate the difference between the maximum gradation value and the minimum gradation value of the pixels included in the small area. (2) Based on the distribution of the small areas with respect to the difference of the gradation values, an average gradation difference of the distribution of the small areas having a relatively large difference is obtained, and a reference composed of a predetermined number of small areas. The arithmetic mean of the maximum or minimum gradation value of the small area included in the reference area is determined in units of the area. (3) The arithmetic mean is corrected based on the average gradation difference to determine a threshold value for each of the reference areas.
【請求項5】請求項1〜4のいずれかに記載の2値化方
法を用いて光学情報を読み取るよう構成されていること
を特徴とする光学情報読取装置。
5. An optical information reading apparatus configured to read optical information by using the binarization method according to claim 1.
【請求項6】請求項1〜4のいずれかに記載の2値化方
法を用いて読取対象の情報コードを画像データとして復
元するコード品質判断補助装置。
6. A code quality judgment assisting device for restoring an information code to be read as image data using the binarization method according to claim 1.
JP08182699A 1999-03-25 1999-03-25 Information code binarization method, optical information reading apparatus using the binarization method, and code quality judgment assisting apparatus using the binarization method Expired - Fee Related JP3994571B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP08182699A JP3994571B2 (en) 1999-03-25 1999-03-25 Information code binarization method, optical information reading apparatus using the binarization method, and code quality judgment assisting apparatus using the binarization method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP08182699A JP3994571B2 (en) 1999-03-25 1999-03-25 Information code binarization method, optical information reading apparatus using the binarization method, and code quality judgment assisting apparatus using the binarization method

Publications (2)

Publication Number Publication Date
JP2000276553A true JP2000276553A (en) 2000-10-06
JP3994571B2 JP3994571B2 (en) 2007-10-24

Family

ID=13757290

Family Applications (1)

Application Number Title Priority Date Filing Date
JP08182699A Expired - Fee Related JP3994571B2 (en) 1999-03-25 1999-03-25 Information code binarization method, optical information reading apparatus using the binarization method, and code quality judgment assisting apparatus using the binarization method

Country Status (1)

Country Link
JP (1) JP3994571B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010086324A (en) * 2008-09-30 2010-04-15 Fujitsu Ltd Binarization processing apparatus, information processing apparatus, binarization processing method, and binarization processing program
JP4473335B1 (en) * 2009-03-27 2010-06-02 株式会社オプトエレクトロニクス Optical information reading apparatus and optical information reading method
JP2020155128A (en) * 2019-03-19 2020-09-24 コグネックス・コーポレイション System and method for evaluating symbols

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010086324A (en) * 2008-09-30 2010-04-15 Fujitsu Ltd Binarization processing apparatus, information processing apparatus, binarization processing method, and binarization processing program
JP4473335B1 (en) * 2009-03-27 2010-06-02 株式会社オプトエレクトロニクス Optical information reading apparatus and optical information reading method
JP2010231644A (en) * 2009-03-27 2010-10-14 Optoelectronics Co Ltd Optical information reading device and optical information reading method
JP2020155128A (en) * 2019-03-19 2020-09-24 コグネックス・コーポレイション System and method for evaluating symbols
CN111738026A (en) * 2019-03-19 2020-10-02 康耐视公司 System and method for evaluating symbols
JP7039640B2 (en) 2019-03-19 2022-03-22 コグネックス・コーポレイション Systems and methods for evaluating symbols

Also Published As

Publication number Publication date
JP3994571B2 (en) 2007-10-24

Similar Documents

Publication Publication Date Title
JP5701182B2 (en) Image processing apparatus, image processing method, and computer program
JP4288756B2 (en) Information code approximate existence area estimation method, information code reading method and apparatus, and recording medium
JPS60204177A (en) Picture signal processor
JPH02502419A (en) image identification
JPH02196565A (en) Picture binarizing system
JP3040896B2 (en) Image processing device
JPS58220563A (en) Character and pattern picture image extracting system
JP2000276553A (en) Method for binarizing information code, optical information reader using this binarizing method, and code quality judging auxiliary equipment using this binarizing method
JP3915795B2 (en) Image processing apparatus and image processing program
WO2020065980A1 (en) Image processing device, control method and control program
JP4172399B2 (en) Image processing apparatus and program
JP2874592B2 (en) Image processing device for distinguishing text / photo / dot area
JP4706187B2 (en) Character recognition device and character recognition method thereof
JP2002112029A (en) Method for binarizing video and method for generating binary image
JP2522310B2 (en) Optical character reader
US20100067066A1 (en) Outlining method for properly representing curved line and straight line, and image compression method using the same
JP3475606B2 (en) Image processing device
JP2730775B2 (en) Image processing device
JPS6218171A (en) Method and circuit for processing picture
JPS5963884A (en) Picture reader
JP2000261666A (en) Image processing unit
JP2007201607A (en) Image input apparatus, image input method, and image input program
JP2006173955A (en) Image processing apparatus
JPH0456507B2 (en)
JPH11177815A (en) Image data processor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050331

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070702

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: 20070710

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070723

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100810

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100810

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100810

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110810

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120810

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120810

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120810

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130810

Year of fee payment: 6

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees