JPH02277186A - Binarizing device - Google Patents

Binarizing device

Info

Publication number
JPH02277186A
JPH02277186A JP1192515A JP19251589A JPH02277186A JP H02277186 A JPH02277186 A JP H02277186A JP 1192515 A JP1192515 A JP 1192515A JP 19251589 A JP19251589 A JP 19251589A JP H02277186 A JPH02277186 A JP H02277186A
Authority
JP
Japan
Prior art keywords
pixel
interest
sub
value
pixels
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
JP1192515A
Other languages
Japanese (ja)
Other versions
JP2507811B2 (en
Inventor
Koichi Toyama
公一 外山
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Publication of JPH02277186A publication Critical patent/JPH02277186A/en
Application granted granted Critical
Publication of JP2507811B2 publication Critical patent/JP2507811B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Character Input (AREA)

Abstract

PURPOSE:To turn an unclear picture into a clear one by preparing plural deciding means and binarizing the picture after deciding whether a noted subwindow is equal to a line graphic part or not based on the outputs of those deciding means. CONSTITUTION:A line picture 1 is photographed by an image sensor 2 and converted into a gradation picture by an A/D converter 3. This gradation picture is stored in a frame memory 4 and then read out for each picture element in the same scanning order as the sensor 2. Thus a mobile subwindow is formed by a 2-dimensional local memory 5. Then a local averaging part 6 calculates the average density value Aij and stores this value in an average density value memory 12 for the local area of a noted picture element. Then a threshold value detecting part 7 calculates the density difference between the noted picture element and a nearby picture element and checks whether this difference is kept within a range of the set value or not. If so, the average value is obtained among all picture elements and defined as the threshold value PA. This value PA is compared with the allowable density difference G0 via a comparator 10. When the value PA is smaller than the difference G0, the even density is secured among local areas. Thus a clear binarized picture is obtained.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、光学式文字読取装置1ffi (OCR)ま
たは文字図形入力装置等における、レーザ刻印文字や捺
印文字等を含む線図形画像や、物体表面のキズ、クラン
ク、割れ、ヒビ、ゴミなどを撮像して得られる線状の画
像を、画像識別のために2値化する2値化装置に関する
Detailed Description of the Invention [Field of Industrial Application] The present invention is applicable to optical character reading devices 1ffi (OCR), character and graphic input devices, etc., which are used to capture line graphic images including laser-engraved characters, stamped characters, etc., and objects. The present invention relates to a binarization device that binarizes linear images obtained by imaging surface scratches, cracks, cracks, cracks, dust, etc. for image identification.

第17図は、2値化の対象とする対象画像の一例を示し
た説明図である。同図は、検査物202の表面にキズ2
03が発生しているところを示したものであり201は
画面である。キズ203は細長く、線分のような形状を
していることを特徴とする。このような特徴を有するキ
ズ、ゴミの例としては、食品または食器類表面に付着し
た人間の髪の毛、鋳造物のヒビ割れ、金属面上のヒラカ
キ傷等多種多様のものがある。
FIG. 17 is an explanatory diagram showing an example of a target image to be binarized. The figure shows scratches 2 on the surface of the inspection object 202.
03 is generated, and 201 is a screen. The flaw 203 is characterized by being elongated and shaped like a line segment. Examples of scratches and dirt having such characteristics include a wide variety of things, such as human hair attached to the surface of food or tableware, cracks in castings, and scratches on metal surfaces.

〔従来の技術〕[Conventional technology]

一般に、低コントラストのレーザ刻印文字や捺印文字等
については、その背景の明暗ムラやヨゴレ等のために鮮
明な2値画像を得ることが難しい。
Generally, it is difficult to obtain a clear binary image of low-contrast laser-engraved characters, stamped characters, etc. due to uneven brightness and dirt in the background.

このため、出願人は2値化レベルを固定値に設定する方
式に代え、例えば画像の背景レベルの変動を考慮し、2
値化レベルが常に最適となるよう自動的に決定する方式
を提案している(例えば、特願昭60−158032号
明細書参照)。
Therefore, instead of setting the binarization level to a fixed value, the applicant took into consideration the fluctuation of the background level of the image, for example, and
A method has been proposed for automatically determining the valuation level so that it is always optimal (see, for example, Japanese Patent Application No. 158032/1982).

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

しかしながら、かかる場合に線図形を背景の濃度に近い
闇値レベルで2値化すると、線図形部分が太く出るかわ
りに背景の明暗ムラやヨゴレなども2値化されて判読が
困難となり、逆に背景の明暗ムラやヨゴレが出ないよう
な闇値レベルで2値化すると線文字がかすれてしまう、
つまり、従来のものはいずれも線文字とヨゴレとの区別
をしていないため、同じ程度の濃度値ならば同じように
2値化してしまうという問題がある。
However, in such a case, if the line figure is binarized at a darkness value level close to the density of the background, the line figure part will appear thicker, but the uneven brightness and dirt in the background will also be binarized, making it difficult to decipher. If you binarize at a darkness value level that does not cause uneven brightness or smudges in the background, the line characters will become blurred.
In other words, since none of the conventional methods distinguishes between line characters and dirt, there is a problem in that if the density values are the same, they are binarized in the same way.

したがって、本発明は、線図形よりも幅の広いヨゴレや
背景の濃度ムラ等を線図形と区別することにより、低コ
ントラストの文字線や線状のキズなどの画像でも鮮明な
2値化画像とすることのできる2値化装置を提供するこ
とを目的とする。
Therefore, the present invention distinguishes smudges that are wider than line figures, density unevenness in the background, etc. from line figures, so that even images with low contrast character lines or linear scratches can be converted into clear binarized images. The object of the present invention is to provide a binarization device that can perform the following operations.

〔課題を解決するための手段〕[Means to solve the problem]

上記目的達成のため、本発明では、背景とその上に描か
れた線図形とを2次元的に撮像して得られる画像データ
を画素化してメモリに取り込んだ後、該メモリから画素
を読み出して各画素毎に、それが背景部分に当たる画素
であるか、線図形部分に当たる画素であるか、によって
2値化する2値化装置において、前記線図形を構成する
線の幅に応じて、2値化の対象とする着目画素単独又は
該着目画素とその周辺画素をまとめて注目サブウィンド
ウを設定すると共に、同様に線図形を構成する線の幅に
応じて、前記着目サブウィンドウの周辺に、単独画素又
は該単独画素とその周辺画素をまとめて構成したサブウ
ィンドウを複数個設定し、前記各サブウィンドウを前記
メモリから順次読み出してくるサブウィンドウ読み出し
手段と、その各サブウィンドウ毎に平均濃度値を演算す
る演算手段と、サブウィンドウ毎の着目画素とその近傍
画素との差分値のうち所定範囲内のものの平均値を算出
する平均値算出手段と、該平均値算出手段による着目サ
ブウィンドウとその周辺サブウィンドウについての各平
均値に基づいて該当ウィンドウ群内領域が均一濃度領域
か否か判定する第1の判定手段と、着目サブウィンドウ
とその周辺サブウィンドウの平均濃度値から各周辺サブ
ウィンドウが背景部分に当たるか、否かを判定する第2
の判定手段とを備え、これら第1、第2の判定手段から
の出力に基づき着目サブウィンドウが線図形部分に当た
るか否かを判定して2値化するようにした。
In order to achieve the above object, in the present invention, image data obtained by two-dimensionally imaging a background and a line figure drawn thereon is converted into pixels and captured into a memory, and then the pixels are read out from the memory. In a binarization device that binarizes each pixel depending on whether it is a pixel that corresponds to a background part or a pixel that corresponds to a line figure part, At the same time, a sub-window of interest is set for a pixel of interest that is the target of conversion, or a pixel of interest and its surrounding pixels are set as a sub-window. sub-window reading means for setting a plurality of sub-windows each consisting of the individual pixel and its surrounding pixels, reading each of the sub-windows sequentially from the memory; and calculating means for calculating an average density value for each of the sub-windows; an average value calculation means for calculating an average value of difference values between a pixel of interest and its neighboring pixels for each subwindow within a predetermined range; and an average value calculation means based on each average value of the subwindow of interest and its surrounding subwindows by the average value calculation means. a first determining means for determining whether the region within the corresponding window group is a uniform density region; and a second determining means for determining whether each peripheral sub-window corresponds to a background portion based on the average density value of the sub-window of interest and its peripheral sub-windows.
Based on the outputs from the first and second determining means, it is determined whether or not the sub-window of interest corresponds to a line figure portion, and binarization is performed.

また、かかる2値化装置において、着目サブウィンドウ
に対する周辺サブウィンドウの選択の仕方を、着目サブ
ウィンドウから見てどの周辺サブウィンドウも、同一距
離に位置するように座標選択した。
Furthermore, in such a binarization apparatus, the coordinates of peripheral sub-windows for a sub-window of interest are selected such that all peripheral sub-windows are located at the same distance from the sub-window of interest.

〔作用〕[Effect]

以下、作用として本発明による場合の2値化の判定原理
を説明しておく。
Hereinafter, the determination principle of binarization according to the present invention will be explained as an operation.

第18図は画面を構成する各画素の中から、2値化の対
象とする着目画素と、その周辺画素の選び方を示した説
明図である。即ち、着目画素POに対し近傍画素P1〜
P8を次のような座標位置において求める。
FIG. 18 is an explanatory diagram showing how to select a pixel of interest to be binarized and its surrounding pixels from among the pixels constituting the screen. That is, the neighboring pixels P1 to P1 to the pixel of interest PO
P8 is determined at the following coordinate position.

PO(x、y)、PL(x−d、y−d)。PO (x, y), PL (x-d, y-d).

P2(x、 Y−d) 、 PG(x十d、 y−d)
 。
P2(x, Y-d), PG(x1d, y-d)
.

P4(x−d、y)、P5(x+d、y)。P4 (x-d, y), P5 (x+d, y).

P6(x−d、 y十d) 、 P7(x、 y+d)
 。
P6 (x-d, y 10 d), P7 (x, y + d)
.

P8(x+d、y+d) 第18図はd=3(画素数)の場合の例である。dは対
象画像の線の幅などにより決まる定数である。
P8 (x+d, y+d) FIG. 18 is an example where d=3 (number of pixels). d is a constant determined by the width of the line in the target image.

第19図は、対象画像の線の幅に応じて、着目画素と周
辺画素をどう選ぶかの具体例を示した説明図である。
FIG. 19 is an explanatory diagram showing a specific example of how to select a pixel of interest and peripheral pixels according to the width of a line in a target image.

同図(a)では垂直方向の対象画像Rの線の幅が丁度1
画素を少し上回る程度の線画像が示されており、同図(
b)では斜め方向の対象画像Rの線の幅がやはり1画素
を少し上回る程度の線画像が示されているが、このよう
なときは、d=1に選び、図示の如く着目画素POに対
して、その周辺に1画素置いてPI、P2.〜P7.P
8の如く周辺画素を選ぶと、着目画素POの2値化のた
めの後述の操作がうまくいく。
In the same figure (a), the width of the line of the target image R in the vertical direction is exactly 1.
A line image slightly larger than pixels is shown, and the same figure (
b) shows a line image in which the line width of the target image R in the diagonal direction is a little more than 1 pixel. On the other hand, if one pixel is placed around it, PI, P2. ~P7. P
If peripheral pixels such as 8 are selected, the below-described operation for binarizing the pixel of interest PO will be successful.

なお画像Rの線の幅が複数画素にわたるほど広い場合に
は、それに応じて画素の塊りを考えて着目サブウィンド
ウとし、それに対する周辺サブウィンドウを選ぶ。
Note that if the width of the line in the image R is so wide that it spans a plurality of pixels, a cluster of pixels is considered as a sub-window of interest, and surrounding sub-windows are selected accordingly.

ここで画像上の着目画素POを2値化する条件を説明す
ると PO<C1n ((PI−PO>C2n  P8−PO
>C2)tJ(P4−PO>C2n  P5−PO>C
2)U(P6−PO>C2n  PG−PO>C2)U
(P7−PO>C2n  p2−po>C2))なる条
件が成立する場合において、着目画素を論理1とし、成
立しない場合に論理0とする。
Here, to explain the conditions for binarizing the pixel of interest PO on the image, PO<C1n ((PI-PO>C2n P8-PO
>C2)tJ(P4-PO>C2n P5-PO>C
2) U(P6-PO>C2n PG-PO>C2)U
(P7-PO>C2n p2-po>C2)) When the following conditions hold, the pixel of interest is set to logic 1, and when the condition does not hold, it is set to logic 0.

ここでPO〜P8は、各画素の濃度値を与えるものであ
りC1,C2は定数である。定QCI 。
Here, PO to P8 give the density value of each pixel, and C1 and C2 are constants. Constant QCI.

C2は検査画像の表面の状態、照明の加減、キズの特徴
などにより総合的に決まるものである。
C2 is comprehensively determined by the surface condition of the inspection image, the degree of illumination, the characteristics of scratches, etc.

ここで上記2値化の条件を解説すると次の如くである。Here, the conditions for the binarization described above are explained as follows.

上記2値化の条件式で、nはアンドを意味し、Uはオア
を意味する。従って、 PO<C1なる条件(つまり着目画素の濃度が成る定数
01より低く、黒いという条件)と、次の諸条件の中の
何れか一つの条件と、が共に成立するとき、当該着目画
素はlとし、それ以外のときには0とするのである。
In the above conditional expression for binarization, n means AND, and U means OR. Therefore, when the condition PO<C1 (that is, the condition that the density of the pixel of interest is lower than the constant 01 and black) and any one of the following conditions are satisfied, the pixel of interest is It is set to l, and 0 otherwise.

次の諸条件とは、 PL−PO> C2n  P8−PO> C2なる条件
(つまり着目画素POと周辺画素P1の濃度差が成る定
数02より白い、換言すると、着目画素POが黒なら周
辺画素Plも黒であるということと、同様にして着目画
素POが黒なら周辺画素P8も黒であるということ、が
同時に成立するという条件、ここで周辺画素P1とP8
は着目画素POを中心として左斜め方向に対向している
ことに注意されたい)、 P4−PO> C2n  P5−PO> C2なる条件
(着目画素POが黒なら周辺画素P4も黒であるという
ことと、同様にして着目画素POが黒なら周辺画素P5
も黒であるということ、が同時に成立するという条件、
ここで周辺画素P4とP5は着目画素POを中心として
左右方向に対向していることに注意されたい)、 P6−PO> C2n  PG−PO> C2なる条件
(着目画素POが黒なら周辺画素P6も黒であるという
ことと、同様にして着目画素POが黒なら周辺画素P3
も黒であるということ、が同時に成立するという条件、
ここで周辺画素P6とPGは着目画素POを中心として
右斜め方向に対向していることに注意されたい)、 P7−PO> C2n  P2−PG > C2なる条
件(着目画素POが黒なら周辺画素P7も黒であるとい
うことと、同様にして着目画素POが黒なら周辺画素P
2も黒であるということ、が同時に成立するという条件
、ここで周辺画素P7とP2は着目画素POを中心とし
て上下方向に対向していることに注意されたい)、 である。
The following conditions are: PL-PO> C2n P8-PO> C2 (that is, the density difference between the pixel of interest PO and the surrounding pixel P1 is whiter than the constant 02; in other words, if the pixel of interest PO is black, the surrounding pixel Pl If the pixel of interest PO is black, the surrounding pixel P8 is also black. Here, the surrounding pixels P1 and P8 hold together.
Note that they are diagonally opposite to the left with the pixel of interest PO as the center), P4-PO>C2n P5-PO>C2 (if the pixel of interest PO is black, the surrounding pixel P4 is also black) Similarly, if the pixel of interest PO is black, the surrounding pixel P5
The condition that both are also black holds true at the same time.
Note that the peripheral pixels P4 and P5 are opposite to each other in the horizontal direction with the pixel of interest PO as the center), P6-PO>C2n PG-PO>C2 (if the pixel of interest PO is black, the surrounding pixel P6 Similarly, if the pixel of interest PO is black, the surrounding pixel P3
The condition that both are also black holds true at the same time.
Note that the peripheral pixels P6 and PG are opposite to each other diagonally to the right with the pixel of interest PO as the center), P7-PO>C2n P2-PG>C2 (if the pixel of interest PO is black, the surrounding pixels P7 is also black, and similarly, if the pixel of interest PO is black, the surrounding pixels P
2 is also black (note that the peripheral pixels P7 and P2 are vertically opposed to each other with the pixel of interest PO as the center).

すでに理解されたように、着目画素POが黒で、着目画
素POを中心とした何れか1mの対向周辺画素が共に黒
ならば、その着目画素POはlとし、それ以外のときは
Oにするということを上記2値化の条件式は示している
わけである。
As already understood, if the pixel of interest PO is black and the opposing surrounding pixels within 1 m of the pixel of interest PO are both black, then the pixel of interest PO is set to 1, otherwise it is set to 0. This is what the above conditional expression for binarization indicates.

このような条件で2値化を行えば、第19図(a)、 
(b)からも推定できるように、対象とする線画像の線
幅が、1画素より少し大きい程度である場合、着目画素
の2値化が正しく行われるであろうことが理解されるで
あろう。
If binarization is performed under these conditions, Figure 19(a),
As can be estimated from (b), it is understood that if the line width of the target line image is slightly larger than one pixel, the binarization of the pixel of interest will be performed correctly. Dew.

なお周辺画素を、例えば第19図に示す如く選んだ場合
、着目画素POから見た周辺画素までの距離は、上下左
右の各画素までの距離に比較して斜め右方向又は斜め左
方向に位置する各画素までの距離の方が4倍だけ長いこ
とが認められるであろう。このように着目画素POから
周辺画素に至るまでの距離が、全周辺画素について同じ
でないということが、着目画素の2値化に関して悪影響
を及ぼすことに鑑み、着目画素POからどの周辺画素に
至る距離もすべて等しくなるように、周辺画素を選択す
るというのが本出願におけるもう一つの実施例の原理で
ある。
Note that when the surrounding pixels are selected as shown in FIG. 19, for example, the distance from the pixel of interest PO to the surrounding pixels is located diagonally to the right or to the left compared to the distance to each pixel on the top, bottom, left, and right. It will be observed that the distance to each pixel is four times longer. Considering that the fact that the distance from the pixel of interest PO to the surrounding pixels is not the same for all surrounding pixels has a negative effect on the binarization of the pixel of interest, the distance from the pixel of interest PO to which surrounding pixel is The principle of another embodiment in this application is to select surrounding pixels such that all pixels are equal.

〔実施例〕〔Example〕

以下、図面を参照して本発明の一実施例を詳細に説明す
る。
Hereinafter, one embodiment of the present invention will be described in detail with reference to the drawings.

第1図は本発明の一実施例を示す構成図である。FIG. 1 is a block diagram showing an embodiment of the present invention.

同図において、1は線画、2はテレビカメラ等のイメー
ジセンサ、3はアナログ/ディジタル(A/D)変換器
、4はフレームメモリ、5は公知の2次元局部メモリ、
6は局所平均部、7は闇値検出部、8はアドレス発生部
、9は線分判定部、10A、IOBは比較器、IIAは
許容濃度差可変設定部、llBは周囲濃度差可変設定部
、12は平均濃度値メモリ、13は均一/不均一判定メ
モリ、14は着目平均濃度値ランチ回路、15は減算器
、16は2値画像メモリである。
In the figure, 1 is a line drawing, 2 is an image sensor such as a television camera, 3 is an analog/digital (A/D) converter, 4 is a frame memory, 5 is a known two-dimensional local memory,
6 is a local average section, 7 is a dark value detection section, 8 is an address generation section, 9 is a line segment judgment section, 10A and IOB are comparators, IIA is a permissible density difference variable setting section, 11B is an ambient density difference variable setting section , 12 is an average density value memory, 13 is a uniformity/nonuniformity determination memory, 14 is a target average density value launch circuit, 15 is a subtracter, and 16 is a binary image memory.

動作について説明する。The operation will be explained.

任意の線画1をテレビカメラなどのイメージセンサ2で
撮像し、A/D変換器3で濃淡画像に変換し、フレーム
メモリ4に記憶する。フレームメモリ4の線画の濃淡画
像を1画素ずつテレビカメラの走査順序と同じように読
み出して、2次元局・部メモリ5により例えば3×3の
移動サブウィンドウを構成する。着目画素の局所領域に
ついて、局所平均部6で平均濃度値Aijを演算し、こ
れをメモリ12へ記憶する。
An arbitrary line drawing 1 is imaged by an image sensor 2 such as a television camera, converted into a grayscale image by an A/D converter 3, and stored in a frame memory 4. The grayscale image of the line drawing in the frame memory 4 is read out pixel by pixel in the same manner as the scanning order of a television camera, and a two-dimensional station memory 5 forms a moving sub-window of, for example, 3×3. The local averaging unit 6 calculates an average density value Aij for the local area of the pixel of interest, and stores this in the memory 12.

闇値検出部7では各サブウィンドウにおいて着目画素と
近傍画素との8つの濃度差を算出し、その値が予め設定
された範囲内にあるかチエツクし、範囲内のものについ
てはその平均値を求め、この平均値を処理領域内におい
てすべて求め、さらにその平均値をもって、該処理領域
内におけるコントラスト条件としての闇値PAとし、こ
れを許容濃度差と比較器10Aにおいて比較する。閾値
PAが許容濃度差Goよりも大きければ局所領域が濃度
的に不均一と考えられるので、判定フラグFijを“0
°°とする。また許容濃度Goより小さければ局所領域
は濃度的に均一とみなせるので判定フラグFijを“1
°゛とする。ここで、許容値Goは可変設定部11Aに
より可変であり、比較器10ムにより判定フラグFij
が決定される。
The darkness value detection unit 7 calculates eight density differences between the pixel of interest and neighboring pixels in each sub-window, checks whether the values are within a preset range, and calculates the average value for those within the range. , all of these average values are determined within the processing area, and the average value is used as a darkness value PA as a contrast condition within the processing area, and this is compared with the allowable density difference in the comparator 10A. If the threshold value PA is larger than the allowable density difference Go, it is considered that the local area is uneven in density, so the determination flag Fij is set to "0".
Let it be °°. Also, if the density is smaller than the allowable density Go, the local area can be considered to be uniform in density, so the determination flag Fij is set to "1".
°゛. Here, the allowable value Go is variable by the variable setting section 11A, and the determination flag Fij is set by the comparator 10.
is determined.

二の判定フラグFijはメモリ13に記憶される。The second determination flag Fij is stored in the memory 13.

以上のように文字を2値化する際にコントラスト条件と
して指定する閾値を対象とする画像の状況に応じて変化
させるものである。
As described above, when converting characters into binarized characters, the threshold value specified as a contrast condition is changed depending on the situation of the target image.

この理由を第8図A、Bを用いて説明すると、第8図A
、Bは同一字種を刻印した2つの画像の濃度ヒトスゲラ
ムを照明を変動させて模式的に示したものである。今、
黒レベルの101の部分がそれぞれ文字の濃度レベルに
対応すると仮定すれば、コントラスト条件は102に示
されるような背景部分との濃度差分AMの大小によりお
およそ求まることになるが、対象とする画像のダイナミ
ックレンジは照明の変動や背景レベルの変!Jl (賜
物面を例にとると白っぽいものから灰色っぽいものまで
)により、2値化のための最適な闇値(幅AMの中間位
に闇値は選択される)が違ってくる。
The reason for this is explained using Fig. 8 A and B. Fig. 8 A
, B schematically shows the density of two images in which the same character type is engraved by varying the illumination. now,
Assuming that each part 101 of the black level corresponds to the density level of a character, the contrast condition is roughly determined by the magnitude of the density difference AM with the background part as shown in 102, but the contrast condition of the target image Dynamic range depends on changes in lighting and background level! The optimal dark value for binarization (the dark value is selected in the middle of the width AM) differs depending on the Jl (for example, from whitish to grayish).

従って充分な線部分の強調を行わなければ文字によって
かすれが発生することになるが、本発明によれば、コン
トラスト条件として与えるべき闇値を自動的に追従させ
ることもできるので、良好な画像の得られる状態を保持
し、文字読取率の向上に寄与することができる。
Therefore, if line parts are not emphasized sufficiently, characters will become blurred, but according to the present invention, it is possible to automatically follow the darkness value that should be given as a contrast condition, so a good image can be created. It is possible to maintain the obtained state and contribute to improving the character reading rate.

第1図に戻り、平均濃度値メモリ12と判定フラグメモ
リ13の内容を、離散サブウィンドウのアドレス発生部
8により着目サブウィンドウ、周辺サブウィンドウの順
番で読み出す。着目サブウィンドウにおける平均濃度値
Coをラッチ回路14にラッチし、これと周辺の平均濃
度値Ck(k=1・・・8)の差Dkを減算器15にて
演算する。ここで、黒文字ではDk =max (0,
Ck−Co )であり、白文字ではDk =max (
O,Co−Ck )である。なお、周囲濃度差の許容値
Doは、可変設定部11Bにより変えることができる。
Returning to FIG. 1, the contents of the average density value memory 12 and the determination flag memory 13 are read out in the order of the target subwindow and the peripheral subwindow by the discrete subwindow address generation unit 8. The average density value Co in the sub-window of interest is latched in the latch circuit 14, and the subtracter 15 calculates the difference Dk between this and the surrounding average density value Ck (k=1...8). Here, for black letters, Dk = max (0,
Ck-Co ), and for white letters Dk = max (
O, Co-Ck). Note that the allowable value Do of the ambient concentration difference can be changed by the variable setting section 11B.

周囲濃度差Dkと許容値Doとを比較器’l OBで比
較して、濃度差が背景濃度値と線分濃度値との蓋取上か
否かを判定して、背景判定フラグHkの値を決定する。
The ambient density difference Dk and the allowable value Do are compared with the comparator 'l OB, and it is determined whether the density difference is the difference between the background density value and the line segment density value, and the value of the background determination flag Hk is determined. Determine.

文字線判定部9では均一判定フラグFkと背景判定フラ
グHkとにより、着目画素が線分画素であるか否かを判
定し、メモリ16に記憶する。2値画像Tはメモリ16
から読み出される。以上が、実施例の概要動作である。
The character line determination unit 9 determines whether the pixel of interest is a line segment pixel or not based on the uniformity determination flag Fk and the background determination flag Hk, and stores the result in the memory 16. Binary image T is stored in memory 16
is read from. The above is the general operation of the embodiment.

以下、第2図ないし第9図を参照して、詳細に説明する
Hereinafter, a detailed explanation will be given with reference to FIGS. 2 to 9.

第2図に、イメージセンサ2で撮像した線画(文字を含
む)1の濃淡画像の例を示す。ここでは、黒い文字20
が白の背景21の中にあり、走査方向と同じ方向に3×
3のサブウィンドウ22が移動する。サブウィンドウ2
2は2次元局部メモリ5で作られる。なお3×3画素の
サブウィンドウを形成するのは、孤立したノイズなどの
影響を除去するためである。
FIG. 2 shows an example of a grayscale image of the line drawing (including characters) 1 captured by the image sensor 2. Here, the black character 20
is in the white background 21, and 3× in the same direction as the scanning direction.
The subwindow 22 of No. 3 moves. Sub window 2
2 is created in a two-dimensional local memory 5. Note that the reason for forming a 3×3 pixel sub-window is to remove the influence of isolated noise and the like.

サブウィンドウ群の具体例を第3図に示す。この実施例
では、各サブウィンドウごとに平均濃度値と均一判定フ
ラグとを演算してメモリ12.13に記憶するので、メ
モリ12.13の1画素は個々のサブウィンドウ(原画
像の3×3画素)と対応することになる。つまり、平均
濃度値および均一判定フラグは、メモリ12および13
の1画素にそれぞれ写像(マツピング)される。第3図
は、このサブウィンドウがX方向およびY方向にそれぞ
れSx、SYのスパンで3×3個配置された例である。
A specific example of the subwindow group is shown in FIG. In this embodiment, the average density value and uniformity determination flag are calculated for each sub-window and stored in the memory 12.13, so one pixel in the memory 12.13 corresponds to each sub-window (3 x 3 pixels of the original image). This will correspond to In other words, the average density value and the uniformity determination flag are stored in the memories 12 and 13.
Each pixel is mapped to one pixel. FIG. 3 shows an example in which 3×3 sub-windows are arranged in the X and Y directions with spans of Sx and SY, respectively.

すなわち、着目サブウィンドウWsoを構成する3×3
の着目画素の濃度値をPijとし、着目サブウィンドウ
WsOのまわりに周囲サブウィンドウW s (W s
 1 = W s8)を8個定義する。
In other words, 3×3 configuring the sub-window of interest Wso
Let the density value of the pixel of interest in Pij be Pij, and surrounding subwindows W s (W s
1 = W s8) are defined.

3×3画素からなる個々のサブウィンドウWsの平均濃
度値を演算する局所平均部の例を、第4図に示す。この
局所平均部6は9人力l出力の切り換えを行う切換回路
61、加算回路62、ラッチ回路63および除算回路6
4から構成される。
FIG. 4 shows an example of a local averaging unit that calculates the average density value of each subwindow Ws consisting of 3×3 pixels. This local averaging section 6 includes a switching circuit 61 for switching the nine human power outputs, an adding circuit 62, a latch circuit 63, and a dividing circuit 6.
Consists of 4.

すなわち、サブウィンドウWs内の9個の画素濃度値P
sO=Ps8を、切換回路61により1ずつ加算回路6
2へ出力し、出力結果をラッチ回路63でラッチするこ
とにより累加算を行い、これを除算回路64において定
数9で割って平均値Aijを演算するものである。なお
、このとき、ラッチ回路63の初期値はゼロとされる。
That is, the nine pixel density values P within the subwindow Ws
The switching circuit 61 adds sO=Ps8 by 1 to the adding circuit 6.
2, the output result is latched by a latch circuit 63 to perform cumulative addition, and the result is divided by a constant 9 in a division circuit 64 to calculate an average value Aij. Note that at this time, the initial value of the latch circuit 63 is set to zero.

また、平均値Aijを数式で表現すると次式の如くなる
Moreover, when the average value Aij is expressed in a mathematical formula, it becomes as shown in the following formula.

A ij = (PsO+Psl+Ps2+Ps3+P
s4+Ps5+Ps6+Ps7+Ps8)/9こうして
得られる各サブウィンドウ毎の平均濃度値は、第1図の
メモリ12に記憶される。
Aij = (PsO+Psl+Ps2+Ps3+P
s4+Ps5+Ps6+Ps7+Ps8)/9 The average density value for each sub-window thus obtained is stored in the memory 12 in FIG.

闇値検出部の具体例を第5回に示す。これは差分濃度検
出回路71と、平均値算出回路72と、闇値算出回路7
3とからなり、次のようにして闇値PAを求める。
A specific example of the dark value detection section is shown in Part 5. This includes a differential density detection circuit 71, an average value calculation circuit 72, and a dark value calculation circuit 7.
3, and the darkness value PA is calculated as follows.

第9図は文字部分を2値化する際に用いられる2次元局
部メモリ領域を示し、103に示される8つの近傍画素
と104に示される1つの着目画素とにより構成され、
次の式で与えられる。
FIG. 9 shows a two-dimensional local memory area used when binarizing a character part, and is composed of eight neighboring pixels shown at 103 and one pixel of interest shown at 104,
It is given by the following formula.

近傍画素: N=(P(i−α、j−α)、P(i−α、j)、P(
i−α、j+α)。
Neighboring pixels: N=(P(i-α, j-α), P(i-α, j), P(
i−α, j+α).

P(IIJ−α)、P(i、j+α)、P(i+α+j
−α)IP(i+α、j)、P(++α、j+α))着
目画素: P (11j)  ただしP(i、j)は点
(ij)の濃度を示す関数 α:il!ii素間距離 これ次間距離られた画像内での最適なコントラスト閾値
P^を求める手法を説明する。
P(IIJ-α), P(i, j+α), P(i+α+j
−α) IP(i+α, j), P(++α, j+α)) Pixel of interest: P (11j) where P(i, j) is a function α:il! that indicates the density of point (ij). ii. Distance between elements A method for determining the optimum contrast threshold value P^ within an image with this distance between elements will be explained.

まず、P^の絶対的な変化範囲としてPm1n 。First, Pm1n is the absolute change range of P^.

P waxを設定しておく。Set P wax.

Pm1n≦ PA≦P max 次に近傍画素Nの各点より着目画素の濃度値を引いた差
分濃度をそれぞれ求める(第5図の差分濃度検出回路7
1による)。
Pm1n≦PA≦Pmax Next, the difference density is obtained by subtracting the density value of the pixel of interest from each point of the neighboring pixels N (the difference density detection circuit 7 in FIG.
1).

N’ = (N−P(i、j) ) 次にN”の要素の中でPm1nとP l1laxの間に
あるものを抽出する。
N' = (N-P(i, j)) Next, among the elements of N'', those between Pm1n and P11lax are extracted.

P lll1n≦ N”≦Pmax N”の要素の平均をP’(i、j)とする(以上、第5
図の平均値算出回路72)。
Let P'(i, j) be the average of the elements of Plll1n≦N"≦Pmax N" (the fifth
Average value calculation circuit 72) in the figure.

このP(i、j)を処理画面全域に渡り求め、その差分
濃度値の平均値をもって求めるべき閾値PAとする(第
5図の闇値算出回路73)。
This P(i, j) is determined over the entire processing screen, and the average value of the difference density values is used as the threshold value PA to be determined (darkness value calculation circuit 73 in FIG. 5).

PA  =  Σ P’(i、j>/nrJ その出力PAは比較器10Aにおいて設定値G。PA = Σ P’(i, j>/nrJ Its output PA is the set value G in the comparator 10A.

と比較され、均一判定フラグFijが上述の如く決定さ
れる。なお、判定フラグFijは、メモリ13に記憶さ
れる。
The uniformity determination flag Fij is determined as described above. Note that the determination flag Fij is stored in the memory 13.

着目サブウィンドウと周辺サブウィンドウについて、メ
モリ12と13の内容を読み出すアドレス発生部の具体
例を第6図に示す。なお、同図において、81は基本ク
ロック発信器、82はタイミング制御回路、83A、8
3BはX方向、X方向アドレスカウンタ、84A、84
BはX方向。
FIG. 6 shows a specific example of an address generator that reads out the contents of the memories 12 and 13 for the subwindow of interest and peripheral subwindows. In the figure, 81 is a basic clock oscillator, 82 is a timing control circuit, 83A, 8
3B is the X direction, X direction address counter, 84A, 84
B is the X direction.

X方向アドレスラッチ回路、85A、85Bは加算制御
回路、86A、86BはX方向スパン、X方向スパン可
変設定部、87A、87Bは加減算回路である。
X-direction address latch circuits, 85A and 85B are addition control circuits, 86A and 86B are X-direction span and X-direction span variable setting units, and 87A and 87B are addition and subtraction circuits.

タイミング制御回路82は発信器81からのクロックに
基き制御信号およびタイミング信号を生成し、アドレス
カウンタ83Aに与える。アドレスカウンタ83Aはそ
のタイミングクロックをカウントし、着目サブウィンド
ウのX方向アドレスTo(第3図参照)を出力する一方
、水平走査線1本分毎にアドレスカウンタ83Bをカウ
ントアツプし、Y方向アドレスJoを出力する(第3図
参照)。この着目ウィンドウのアドレス(Io。
Timing control circuit 82 generates a control signal and a timing signal based on the clock from oscillator 81, and provides them to address counter 83A. The address counter 83A counts the timing clock and outputs the X-direction address To (see FIG. 3) of the subwindow of interest, while counting up the address counter 83B every horizontal scanning line and outputs the Y-direction address Jo. Output (see Figure 3). The address of this window of interest (Io.

Jo)は、ラッチ回路84A、84Bにそれぞれラッチ
される。したがって、周辺サブウィンドウのX (Y)
方向のアドレス(1,J)は、このラッチ回路84A(
84B)からの出力と、X (Y)方向スパン設定部8
6A(86B)から与えられるスパン5x(SY)とを
、加減算回路87A(87B)にて加算または減算する
ことにより求めることができる。このとき、加減算制御
回路85A(85B)は加減算回路87A(87B)に
対し、加算または減算の指示を与える。加減算制御回路
85A(85B)による制御内容を表にすると、次表の
如くなる。
Jo) are latched by latch circuits 84A and 84B, respectively. Therefore, X (Y) of the peripheral subwindow
The direction address (1, J) is determined by this latch circuit 84A (
84B) and the X (Y) direction span setting section 8
It can be determined by adding or subtracting the span 5x (SY) given from 6A (86B) using an addition/subtraction circuit 87A (87B). At this time, the addition/subtraction control circuit 85A (85B) gives an instruction for addition or subtraction to the addition/subtraction circuit 87A (87B). The following table shows the contents of control by the addition/subtraction control circuit 85A (85B).

このように、X方向およびX方向について、表に示す順
番で加減算制御回路85A、85Bによる制御を行うこ
とにより、周辺のサブウィンドウのアドレス(l  J
)を発生する。そして、各周辺サブウィンドウの平均濃
度値Aijと均一判定フラグFijを、それぞれCk、
 Fk(k =0.1・・・9)として読み出す。
In this way, by controlling the addition/subtraction control circuits 85A and 85B in the order shown in the table in the X direction and the X direction, the address (l J
) occurs. Then, the average density value Aij and uniformity determination flag Fij of each peripheral sub-window are set as Ck, respectively.
Read out as Fk (k = 0.1...9).

周囲サブウィンドウに関する背景判定フラグHkと、均
一判定フラグFkとから2値化を行う線分判定部の具体
例を第7図(a)に、サブウィンドウの配置を第7図(
b)に示す。線分判定部は、AND (アンド)ゲー)
91A、91B、91C。
A specific example of the line segment determination unit that performs binarization from the background determination flag Hk and uniformity determination flag Fk regarding the surrounding subwindows is shown in FIG. 7(a), and the arrangement of the subwindows is shown in FIG. 7(a).
Shown in b). The line segment determination part is an AND (and) game)
91A, 91B, 91C.

背景カウンタ93、背景数可変設定部95A、比較器9
6Aより構成される。
Background counter 93, background number variable setting section 95A, comparator 9
Consists of 6A.

第7図(a)の回路には、均一判定フラグFkと背景判
定フラグHkについて、k=1とに=5゜k=2とに=
6.に=3とに=7.に=4とに=8の4組のデータが
供給され、両データのFk。
In the circuit of FIG. 7(a), the uniformity determination flag Fk and the background determination flag Hk are set to k=1, k=5, k=2, and
6. ni=3 and ni=7. Four sets of data, 4 and 8, are supplied, and Fk of both data.

Hkがそれぞれ有効であれば、背景カウンタ93にカウ
ントされる。従って背景カウンタにはO〜4のいずれか
の値が入ることになり、可変設定部95Aには着目サブ
ウィンドウを2値化するのに必要な対向サブウィンドウ
の組数が設定され、比較器96Aにて対向サブウィンド
ウの組数が可変設定部95Aに設定された数よりも大き
い場合に着目サブウィンドウひいては着目画素は線分つ
まりlであると判定される。
If each Hk is valid, it is counted in the background counter 93. Therefore, the background counter will receive any value from O to 4, the variable setting section 95A will be set with the number of opposing sub-windows required to binarize the sub-window of interest, and the comparator 96A will set When the number of pairs of opposing sub-windows is larger than the number set in the variable setting section 95A, it is determined that the sub-window of interest, and therefore the pixel of interest, is a line segment, that is, l.

なお、線分判定部9を第7A図のようにすることもでき
る。これはシフトレジスタ98A、98Bおよび2値化
判定メモリ(ROM)99を設け、シフトレジスタ98
A、98BにそれぞれフラグFk、Hkを導入してFo
 =FB 、Ho 〜H8に展開し、これをアドレスと
してメモリ99の内容を読み出すことにより、出力Qを
得るものである。
Note that the line segment determination section 9 can also be configured as shown in FIG. 7A. This is provided with shift registers 98A, 98B and a binarization determination memory (ROM) 99.
Introduce flags Fk and Hk to A and 98B, respectively, and set Fo
=FB, Ho to H8, and by reading out the contents of the memory 99 using this as an address, the output Q is obtained.

以上、実施例について説明したが、各種可変設定値は、
対象とする線図形の性質により最適な値に調整されるこ
とは言うまでもない。また、サブウィンドウとして3×
3画素の・領域を考えたが、この数も適宜に決めること
ができ、極端には1画素とすることもできる。
The embodiments have been described above, but the various variable setting values are as follows:
Needless to say, the value is adjusted to the optimum value depending on the properties of the target line figure. Also, as a sub window, 3×
Although an area of three pixels was considered, this number can be determined as appropriate, and in the extreme, it can be one pixel.

第18図或いは第19図を参照して先にも述べたように
、先の実施例では、着目画素POと周辺画素P1との間
の距離11と、着目画素POと周辺画素P2との間の距
離12の関係が、11=121.2の関係となり、画素
PO〜P8の相対位置について異方性を生じ、発生する
線分状のキズなどの角度により、2値化画像が微妙に変
化し、最終的には2値化精度に影響を及ぼすという不具
合が生じる。x、y直交座標系を用いる限りl=/!2
とすることは原理的に不可能である。
As mentioned earlier with reference to FIG. 18 or FIG. 19, in the previous embodiment, the distance 11 between the pixel of interest PO and the surrounding pixel P1, and the distance 11 between the pixel of interest PO and the surrounding pixel P2 The relationship between the distance 12 becomes the relationship 11=121.2, which causes anisotropy in the relative positions of pixels PO to P8, and the binarized image changes slightly depending on the angle of the line segment scratches that occur. However, a problem arises in that the binarization accuracy is ultimately affected. As long as we use the x,y orthogonal coordinate system, l=/! 2
It is impossible in principle to do so.

一方画素Pi、P3.P6.P8をff1l=f2とな
る様擬似的に最適な位置を選択することは可能であるが
、高速処理を行う上で不都合である。
On the other hand, pixels Pi, P3. P6. Although it is possible to select a pseudo-optimal position for P8 so that ff1l=f2, this is inconvenient for high-speed processing.

先にも参照した第18図においては、POを着目画素と
するとき、その2値化のために必要とされる周辺画素は
、PI−P8の8画素であり、次にPOの隣りのP5を
着目画素とするとき、その2値化のために必要とされる
周辺画素は、POを着目画素としたときに必要であると
して既に取り込んである周辺画素P2.P3.PO,P
5.P7、P8の他に、P9 、  PIO、pHの僅
かに3画素を新たに取り込めばよいだけであるから、高
速処理が可能となる。最初の着目画素POと次の着目画
素P5との間には、3画素の距離があるので、PO,P
5.PIO,・・・を着目画素とする1回のスキャンを
終了したら、着目画素の選び方を1画素だけずらして同
様なスキャンを行い、同様にして合計3回のスキャンを
行えば、lラインの全画素の2値化が終了することにな
る。
In FIG. 18 referred to earlier, when PO is the pixel of interest, the surrounding pixels required for binarization are 8 pixels of PI-P8, and then 8 pixels of P5 next to PO. When PO is the pixel of interest, the surrounding pixels required for its binarization are the surrounding pixels P2 . P3. P.O., P.O.
5. Since only three pixels, P9, PIO, and pH, in addition to P7 and P8 need to be newly captured, high-speed processing is possible. There is a distance of 3 pixels between the first pixel of interest PO and the next pixel of interest P5, so PO, P
5. After completing one scan with PIO,... as the pixel of interest, repeat the same scan by shifting the selection of the pixel of interest by one pixel.If you perform a total of three scans in the same way, all of the Binarization of pixels is now complete.

第10図は、着目画素に対する周辺画素の選択の仕方を
、どの周辺画素も着目画素に対して疑似的に等距離とな
るような最適な位置に選択した例を示す説明図である。
FIG. 10 is an explanatory diagram illustrating an example in which surrounding pixels for a pixel of interest are selected at optimal positions such that all surrounding pixels are pseudo equidistant from the pixel of interest.

同図では、着目画素POに対して、その2値化に必要な
周辺画素としてP1〜P8を選ぶと、周辺画素P1〜P
8は、着目画素POに対してどの周辺画素もほぼ等距離
にあり、その意味では申し分ないが、着目画素が隣りの
P5に移った場合、その2値化に必要な周辺画素として
は、P9〜P15という多(の周辺画素を新たに取り込
まなければならず、高速処理が望めないことになる。
In the figure, when P1 to P8 are selected as peripheral pixels necessary for binarization of the pixel of interest PO, the peripheral pixels P1 to P
8, all the surrounding pixels are approximately equidistant from the pixel of interest PO, which is perfect in that sense, but when the pixel of interest moves to the neighboring pixel PO, the surrounding pixels necessary for its binarization are P9. It is necessary to newly capture many (peripheral pixels) such as ~P15, and high-speed processing cannot be expected.

また、−船釣にnXn画素の2次元局部メモリを用いる
ことが知られているが、n>5の範囲では実現できるハ
ードウェアの規模がnに対して指数的に増大してしまい
実現は非常に困難である。
-Although it is known to use a two-dimensional local memory of nXn pixels for boat fishing, in the range of n>5, the scale of the hardware that can be realized increases exponentially with n, making it extremely difficult to realize. It is difficult to

高速処理を可能とし、着目画素に対してどの周辺画素も
ほぼ等距離にあることを理論上、実現し、対象画像とし
てのキズ、ゴミ、ビビ割れなどの方向性に依存しないで
2値化を行うことのできる2値化装置の実施例を以下、
説明する。
It enables high-speed processing and theoretically realizes that all surrounding pixels are approximately equidistant from the pixel of interest, allowing binarization to be performed without depending on the directionality of the target image, such as scratches, dust, cracks, etc. An example of a binarization device that can perform this is shown below.
explain.

かかる第2の□実施例は、面単に述べると、ビデオカメ
ラからのビデオ信号をフレームメモリに取り込んで記憶
する際に、サンプリング周期及びその位相を操作し、従
来の直交座標系ではなく等距離座標系に変換し、その上
で画像データに対し2値化処理を行うものであると云え
る。
To put it simply, the second embodiment manipulates the sampling period and its phase when capturing and storing a video signal from a video camera in a frame memory, and uses equidistant coordinates instead of the conventional orthogonal coordinate system. It can be said that the system converts the image data into a system, and then performs binarization processing on the image data.

第11図は、着目画素POに対し互いに等距離な周辺画
素P1〜P6を実現できる等距離座標系を示す説明図で
あり、これは以下のように画像データのサンプリングを
行う。
FIG. 11 is an explanatory diagram showing an equidistant coordinate system that can realize peripheral pixels P1 to P6 that are equidistant from each other with respect to the pixel of interest PO, and image data is sampled as follows.

即ち、垂直分解能を1とした場合、1画素のサンプリン
グ時間を−L4 の間隔となるようにし、且つインクレ
ース信号の奇数フィールドE1のサンプリングの位相と
偶数フィールドE2のサンプリングの位相とを1/2画
素(垂直分解能に対しては薯「4)だけずらすことによ
り実現される。
That is, when the vertical resolution is 1, the sampling time of one pixel is set to an interval of -L4, and the sampling phase of the odd field E1 of the incremental signal and the sampling phase of the even field E2 are set to 1/2. This is achieved by shifting the pixels by 4 pixels (with respect to the vertical resolution).

キズなどの対象画像に対する2値化は、第12図の画素
配置においてPOを着目点(着目画素)としP1〜P6
を近傍点(周辺画素)とした場合、PO<C1n  (
(PI−PO>C2n  P4−PO>C2)U(P2
−PO>C2n  P5−PO>C2)U(P3−PO
>C2n  P6−PO>C2))の条件を満たす場合
、着目画素POを1(キズあり)とする。
Binarization of target images such as scratches is performed using PO as the point of interest (pixel of interest) in the pixel arrangement shown in Figure 12, and using P1 to P6.
When is a neighboring point (peripheral pixel), PO<C1n (
(PI-PO>C2n P4-PO>C2)U(P2
-PO>C2n P5-PO>C2)U(P3-PO
>C2n P6-PO>C2)), the pixel of interest PO is set to 1 (scratch).

第12図は画素間距離d=2の例である。本座標系では
、任意のdに対して着目点と近傍点の距離は常に等しい
。着目画素を隣りに移して、次の処理を行う場合は、画
素P7〜P9を新たに読み込み、P5を新たな着目画素
とする。よってd回のスキャンにより処理は完結する。
FIG. 12 is an example in which the inter-pixel distance d=2. In this coordinate system, the distance between the point of interest and neighboring points is always equal for any d. When moving the pixel of interest to an adjacent pixel and performing the next process, pixels P7 to P9 are newly read, and P5 is set as the new pixel of interest. Therefore, the process is completed after d scans.

また本実施例では、近傍画素を6画素に減らすことがで
きるため高速な処理を期待することができる。
Furthermore, in this embodiment, since the number of neighboring pixels can be reduced to six pixels, high-speed processing can be expected.

第13図は、上述の原理に基づく2値化装置を、表面傷
検査装置として応用した場合の実施例を示す説明図であ
る。
FIG. 13 is an explanatory diagram showing an embodiment in which a binarization device based on the above-described principle is applied as a surface flaw inspection device.

同図において、301は画像処理装置、302はカメラ
、303は照明、304は位置センサ、である。検査物
305はパレット306により、矢印Yの方向に搬送さ
れる。検査物305がカメラ302の視野内に入ると、
位置センサ304により感知され、撮像が行われ、該画
像は画像処理装置301内にて演算が行われ、最終的に
画像内のキズの有無(2値化による1又は0)を上位の
制御装置へ伝達することができる。
In the figure, 301 is an image processing device, 302 is a camera, 303 is a light, and 304 is a position sensor. The inspection object 305 is transported in the direction of arrow Y by a pallet 306. When the inspection object 305 enters the field of view of the camera 302,
The image is sensed by the position sensor 304 and imaged, and the image is processed in the image processing device 301.Finally, the presence or absence of scratches in the image (1 or 0 due to binarization) is determined by the upper control device. can be transmitted to.

第14図は画像処理装置301を構成する主なブロック
を示したもので、画像人力部301A。
FIG. 14 shows the main blocks constituting the image processing device 301, including an image processing unit 301A.

画像2値化部301B、フレームメモリ301Cよりな
る。
It consists of an image binarization section 301B and a frame memory 301C.

第15図は画像処理装置301のさらに詳細なブロック
図であり、3011はカメラに対し外部同期信号を発生
するための同期信号発生回路であり、基準信号発生回路
3012に対し垂直同期信号(VD)、水平同期信号C
HD)を与える。基準信号発生回路3012では、VD
、)(Dを逓倍するなどして、等距離座標系となる様、
画像入力時アドレス発生器3013を制御Iシ、フレー
ムメモリ3014へ画像データを記憶させる。2値化は
、2値化時アドレス発生器3015より、フレームメモ
リ3014へのアドレスを発生し、ラッチ回路3016
に画像データを順次ラッチする。
FIG. 15 is a more detailed block diagram of the image processing device 301, in which 3011 is a synchronization signal generation circuit for generating an external synchronization signal for the camera, and a vertical synchronization signal (VD) for the reference signal generation circuit 3012. , horizontal synchronization signal C
HD). In the reference signal generation circuit 3012, VD
, ) (Multiply D so that it becomes an equidistant coordinate system,
When inputting an image, the address generator 3013 is controlled and the image data is stored in the frame memory 3014. For binarization, the address generator 3015 generates an address for the frame memory 3014, and the latch circuit 3016 generates an address for the frame memory 3014.
The image data is latched sequentially.

なお1度データをすべてラッチ回路PO−P6ヘラツチ
した後は、行ラインが更新されない限り、次点での処理
には3画素のデータ更新にて済む。
Note that once all the data has been latched by the latch circuits PO-P6, unless the row line is updated, data for three pixels need only be updated for processing at the next point.

2値化演算回路3017は、入力される7画素のデータ
より、画素間の演算等を行って2値化を行う部分である
。面積カウンタ3018は、2値化結果としてキズと判
別された画素がカウントされるカウンタであり、このカ
ウント結果により検査物を良品、不良品などと判別した
りするのに用いられる。
The binarization arithmetic circuit 3017 is a part that performs arithmetic operations between pixels and the like to binarize input seven-pixel data. The area counter 3018 is a counter that counts pixels that are determined to be flaws as a result of binarization, and is used to determine whether the inspection object is a good product, a defective product, etc. based on the count result.

第15図における画像2値化時アドレス発生器3015
では、具体的には次のようなアドレスを発生する。
Address generator 3015 during image binarization in FIG.
Specifically, the following address will be generated.

POが奇数フィールドEl上にある場合(第16図(A
)参照)、 PO(x、y)に対し PI(x −2X1nt(d/ 2)  1 、  y
  d)P2(x−d、  y) P3(x−2Xint(d/2)   1.  )’+
d)P4(x+2Xint(d/2)、  )’+d)
P5(x+d、  y) P6(x+2Xint(d/2)、  V   d)P
Oが偶数フィールドE2上にある場合(第16図(B)
参照)、 PO(x、y)に対し、 PI(x  2Xint(d/2)、  V  d)P
2(x −d、  y) P3(x −2X1nt(d / 2) 、  y +
 d)P4(x+2Xint(d/2)+1. y+d
)P、5(x+d、  y) P6(x+2Xint(d/2)+1.)’  d)(
但しintは、小数点以下の端数は切り捨て、整数部だ
けをとる関数) となる。
When PO is on odd field El (Fig. 16 (A)
), PO(x, y) and PI(x −2X1nt(d/2) 1, y
d) P2(x-d, y) P3(x-2Xint(d/2) 1.)'+
d) P4(x+2Xint(d/2), )'+d)
P5(x+d, y) P6(x+2Xint(d/2), V d)P
When O is on even field E2 (Fig. 16(B)
), for PO(x, y), PI(x 2Xint(d/2), V d)P
2(x - d, y) P3(x - 2X1nt(d/2), y +
d) P4(x+2Xint(d/2)+1.y+d
)P, 5(x+d, y) P6(x+2Xint(d/2)+1.)' d)(
However, int is a function that cuts off fractions below the decimal point and takes only the integer part.

〔発明の効果〕 本発明によれば、画像の状況に応じて最適な2値化闇値
を求めることができる。さらに、着目画素の近傍領域(
3×3画素)について、平均濃度値と均一判定フラグと
を求めるようにしたので、小さなノイズなどの影響を除
去して正確に2値化することができる。
[Effects of the Invention] According to the present invention, an optimal binarized darkness value can be determined depending on the image situation. Furthermore, the area near the pixel of interest (
Since the average density value and the uniformity determination flag are determined for each pixel (3×3 pixels), it is possible to remove the influence of small noise and perform accurate binarization.

また第2の実施例によれば、着目画素から周辺画素を見
たときの異方性を除去できるので、更に高精度の2値化
が期待できるという利点がある。
Furthermore, according to the second embodiment, since it is possible to remove anisotropy when viewing surrounding pixels from the pixel of interest, there is an advantage that even higher precision binarization can be expected.

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

第1図は本発明の一実施例の構成を示すブロック図、第
2図は線画の一例を示す説明図、第3図は着目サブウィ
ンドウとその周辺サブウィンドウを示す説明図、第4図
は局所平均部の具体例を示す構成図、第5図は局所最大
濃度差検出部の具体例を示す構成図、第6図はアドレス
発生部の具体例を示す構成図、第7図は線分判定部の具
体例を第9図は局部メモリの構成例を示す説明図、第1
0図は着目画素と周辺画素との間の距離をどの周辺画素
についても同じとする画素配置の一例を示す説明図、第
11図、第12図はそれぞれは本発明の別の実施例で採
用する画素配置の説明図、第13図は本発明による2値
化装置の応用例を示す説明図、第14図は第13図にお
ける要部の詳細を示すブロック図、第15図は第13図
における要部の更に詳細を示すブロック図、第16図は
第15図における画像2値化時アドレス発生回路の発生
アドレスの説明図、第17図は線画の他の例を示す説明
図、第18図は着目画素と周辺画素の配置の一例を示す
説明図、第19図は画像の線の幅と着目画素、周辺画素
の配置との関係を示す説明図、である。 符号の説明 1・・・線画、2・・・イメージセンサ、3・・・A/
D変換器、4・・・フレームメモリ、5・・・2次元局
部メモリ、6・・・局所平均部、7・・・局所最大濃度
差検出部、8・・・アドレス発生部、9・・・線分判定
部、ス 13 代理人 弁理士 並 木 昭 夫 代理人 弁理士 松 崎   清 第 舅 図 図 Y(J) 第 図 第6 図 !JITA図 第92 Uj 冨 7 図 (α) k13]〜412;框【イし +11) ワフ゛ウィンドウの配! 冨8A図 9!8B図 J馬 Y π1O図 萬マ■ 第13図 慎14因 01C M12囚 冨15g 篤16囚(A) メしり肉■配置 第17図 118図 遺16図 (B) メ丑1ノ内の配! II9WJ
Fig. 1 is a block diagram showing the configuration of an embodiment of the present invention, Fig. 2 is an explanatory drawing showing an example of a line drawing, Fig. 3 is an explanatory drawing showing a sub-window of interest and its surrounding sub-windows, and Fig. 4 is a local average. 5 is a block diagram showing a specific example of the local maximum concentration difference detection section, FIG. 6 is a block diagram showing a specific example of the address generation section, and FIG. 7 is a line segment determination section. FIG. 9 is an explanatory diagram showing an example of the configuration of the local memory.
Figure 0 is an explanatory diagram showing an example of a pixel arrangement in which the distance between the pixel of interest and surrounding pixels is the same for all surrounding pixels, and Figures 11 and 12 are each adopted in another embodiment of the present invention. FIG. 13 is an explanatory diagram showing an application example of the binarization device according to the present invention, FIG. 14 is a block diagram showing details of the main parts in FIG. 13, and FIG. FIG. 16 is an explanatory diagram of generated addresses of the address generation circuit during image binarization in FIG. 15, FIG. 17 is an explanatory diagram showing another example of line drawing, and FIG. The figure is an explanatory diagram showing an example of the arrangement of a pixel of interest and surrounding pixels, and FIG. 19 is an explanatory diagram showing the relationship between the line width of an image and the arrangement of the pixel of interest and surrounding pixels. Explanation of symbols 1...Line drawing, 2...Image sensor, 3...A/
D converter, 4... Frame memory, 5... Two-dimensional local memory, 6... Local average unit, 7... Local maximum density difference detection unit, 8... Address generation unit, 9...・Line Segment Judgment Department, S 13 Agent: Patent Attorney Akio Namiki Agent: Patent Attorney Kiyoshi Matsuzaki First Father-in-law Diagram Y (J) Figure Figure 6! JITA Figure No. 92 Uj Tomi 7 Figure (α) k13] ~ 412; Frame [I+11) Waffle window arrangement! Figure 8A Figure 9! Figure 8B J Horse Y π1O Figure Manma■ Figure 13 Shin 14 Cause 01C M12 Prisoner Tomi 15g Atsushi 16 Prisoner (A) Meshiriniku ■ Arrangement Figure 17 Figure 118 Remains Figure 16 (B) Meushi Placement within 1! II9WJ

Claims (1)

【特許請求の範囲】 1)背景とその上に描かれた線図形とを2次元的に撮像
して得られる画像データを画素化してメモリに取り込ん
だ後、該メモリから画素を読み出して各画素毎に、それ
が背景部分に当たる画素であるか、線図形部分に当たる
画素であるか、によって2値化する2値化装置において
、 前記線図形を構成する線の幅に応じて、2値化の対象と
する着目画素単独又は該着目画素とその周辺画素をまと
めて着目サブウィンドウを設定すると共に、同様に線図
形を構成する線の幅に応じて、前記着目サブウィンドウ
の周辺に、単独画素又は該単独画素とその周辺画素をま
とめて構成したサブウィンドウを複数個設定し、前記各
サブウィンドウを前記メモリから順次読み出してくるサ
ブウィンドウ読み出し手段と、 読み出された各サブウィンドウについて、各サブウィン
ドウ毎にその平均濃度値を演算する演算手段と、 サブウィンドウ毎の着目画素とその近傍画素との差分値
のうち所定範囲内のものの平均値を算出する平均値算出
手段と、 該平均値算出手段による着目サブウィンドウとその周辺
サブウィンドウについての各平均値に基いて該当ウィン
ドウ群内領域が均一濃度領域か否かを判定する第1の判
定手段と、 着目サブウィンドウとその周辺サブウィンドウの平均濃
度値から各周辺サブウィンドウが背景部分に当るか否か
を判定する第2の判定手段とを備え、これら第1、第2
判定手段からの出力に基き着目サブウィンドウが線図形
部分に当るか否かを判定して2値化することを特徴とす
る2値化装置。 2)請求項1に記載の2値化装置において、着目サブウ
ィンドウに対する周辺サブウィンドウの選択の仕方を、
着目サブウィンドウから見てどの周辺サブウィンドウも
、同一距離に位置するように座標選択したことを特徴と
する2値化装置。
[Claims] 1) Image data obtained by two-dimensionally imaging a background and a line figure drawn thereon is converted into pixels and imported into a memory, and then the pixels are read out from the memory and each pixel is In a binarization device that binarizes each pixel depending on whether it is a pixel that corresponds to a background part or a pixel that corresponds to a line figure part, the binarization is performed according to the width of the line that makes up the line figure. A sub-window of interest is set for the target pixel of interest alone or for the pixel of interest and its surrounding pixels together, and similarly, depending on the width of the line constituting the line figure, the pixel of interest or the pixel of interest and the surrounding pixels are set as a single pixel or the pixel of interest and the surrounding pixels. A subwindow reading means that sets a plurality of subwindows each consisting of a pixel and its surrounding pixels, and sequentially reads out each of the subwindows from the memory; A calculating means for calculating, an average value calculating means for calculating an average value of difference values between a pixel of interest and its neighboring pixels for each sub-window within a predetermined range, and a sub-window of interest and its surrounding sub-windows by the average value calculating means. a first determination means for determining whether or not a region within a corresponding window group is a uniform density region based on each average value of the subwindows; a second determining means for determining whether the first and second
A binarization device characterized in that it determines whether or not a sub-window of interest corresponds to a line graphic part based on an output from a determination means, and then performs binarization. 2) In the binarization device according to claim 1, how to select surrounding sub-windows with respect to the sub-window of interest;
A binarization device characterized in that coordinates are selected such that all peripheral sub-windows are located at the same distance from a sub-window of interest.
JP1192515A 1989-01-13 1989-07-27 Binarization device Expired - Lifetime JP2507811B2 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP1-7301 1989-01-13
JP730189 1989-01-13

Publications (2)

Publication Number Publication Date
JPH02277186A true JPH02277186A (en) 1990-11-13
JP2507811B2 JP2507811B2 (en) 1996-06-19

Family

ID=11662199

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1192515A Expired - Lifetime JP2507811B2 (en) 1989-01-13 1989-07-27 Binarization device

Country Status (1)

Country Link
JP (1) JP2507811B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0721314A (en) * 1993-06-22 1995-01-24 Nec Corp Image processor
US6438265B1 (en) 1998-05-28 2002-08-20 International Business Machines Corp. Method of binarization in an optical character recognition system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0721314A (en) * 1993-06-22 1995-01-24 Nec Corp Image processor
US6438265B1 (en) 1998-05-28 2002-08-20 International Business Machines Corp. Method of binarization in an optical character recognition system

Also Published As

Publication number Publication date
JP2507811B2 (en) 1996-06-19

Similar Documents

Publication Publication Date Title
US5621825A (en) Image processor, image processing method and apparatus applying same
JPH06348850A (en) Gradation picture processor
JPH041866A (en) Method and device for image processing
JPH09101236A (en) Method and apparatus for detecting defect of display
JPH02277186A (en) Binarizing device
JPH06113139A (en) Picture binarization device
JP3598196B2 (en) Periodic pattern defect inspection equipment
JPH08161508A (en) Pattern detecting method
US6995802B2 (en) Image binarization method and binary image creation method
JP3941403B2 (en) Image density unevenness detection method and inspection apparatus
JP2841866B2 (en) Image processing apparatus and method and its application
JPH064670A (en) Pattern matching device for gradation picture
JP2978363B2 (en) Halftone image estimation device
JP2931312B2 (en) Defect inspection method
JPH118798A (en) Ccd camera system and image processing method
JPS6393080A (en) Binarization method for image
JPH048833B2 (en)
JP2020122662A (en) Illumination device for surface inspection and surface inspection device
JP2513528Y2 (en) Gray image processor
JP2008205603A (en) Image processing apparatus and image processing method
JPS62267887A (en) Binarizing device
JPS6238347A (en) Image processor
JPH09330417A (en) Shape measuring unit
JPH07271985A (en) Motion detector and its method
JPS63131272A (en) Decision method for binarization threshold