JPH0591326A - Picture processing device - Google Patents
Picture processing deviceInfo
- Publication number
- JPH0591326A JPH0591326A JP3249983A JP24998391A JPH0591326A JP H0591326 A JPH0591326 A JP H0591326A JP 3249983 A JP3249983 A JP 3249983A JP 24998391 A JP24998391 A JP 24998391A JP H0591326 A JPH0591326 A JP H0591326A
- Authority
- JP
- Japan
- Prior art keywords
- image
- threshold value
- comparison data
- value
- output
- 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.)
- Pending
Links
Landscapes
- Image Processing (AREA)
- Facsimile Image Signal Circuits (AREA)
- Image Analysis (AREA)
Abstract
(57)【要約】
【目的】 周囲の明るさ等が変化しても目的とする2値
画像を得るための2値化用閾値を自動的に設定すること
ができる画像処理装置を提供することを目的としてい
る。
【構成】 濃淡画像を入力する画像入力装置と、該画像
入力装置の出力を受けて所定の閾値と比較して2値化
し、2値画像の座標情報と黒画素の長さデータとを出力
するランレングスエンコーダと、該ランレングスエンコ
ーダの出力を受けるプロセッサとで構成された画像処理
装置において、前記プロセッサ内に、目的とする2値画
像の特徴状態を比較データとして記憶する比較データ記
憶部を設け、該プロセッサは2値化された比較データの
値が基準値に一致するように前記ランレングスエンコー
ダの閾値を順次変化させるように構成する。
(57) [Abstract] [Purpose] To provide an image processing apparatus capable of automatically setting a threshold value for binarization for obtaining a target binary image even if ambient brightness changes. It is an object. An image input device for inputting a grayscale image, and an output of the image input device are compared with a predetermined threshold value and binarized to output coordinate information of a binary image and length data of black pixels. In an image processing apparatus including a run length encoder and a processor that receives an output of the run length encoder, a comparison data storage unit that stores a characteristic state of a target binary image as comparison data is provided in the processor. The processor is configured to sequentially change the threshold value of the run length encoder so that the value of the binarized comparison data matches the reference value.
Description
【0001】[0001]
【産業上の利用分野】本発明は画像処理装置に関し、更
に詳しくは2値化処理のための最的な閾値を自動的に決
めることができるようにした画像処理装置に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image processing apparatus, and more particularly to an image processing apparatus capable of automatically determining a maximum threshold value for binarization processing.
【0002】[0002]
【従来の技術】濃淡画像を所定の閾値で白と黒の2値画
像に変換する画像処理装置が知られている。例えば図8
に示すような濃淡画像があるものとする。この画像の白
を0、黒をnとして階調数n+1の濃淡画像と考える。
ここで、n+1個の各階調の画素の数をカウントして積
算すると、図9に示すようなヒストグラム(度数分布曲
線)が得られる。図9において、横軸は階調(濃淡レベ
ル)、縦軸は画素数である。2. Description of the Related Art There is known an image processing apparatus for converting a grayscale image into a binary image of white and black with a predetermined threshold value. For example, in FIG.
It is assumed that there is a grayscale image as shown in. It is considered that the image is a gray-scale image having a gradation number n + 1, where white is 0 and black is n.
Here, by counting and integrating the number of pixels of n + 1 gradations, a histogram (frequency distribution curve) as shown in FIG. 9 is obtained. In FIG. 9, the horizontal axis represents gradation (gray level) and the vertical axis represents the number of pixels.
【0003】このヒストグラムからヒストグラム参照法
を用いて2値化用の閾値を決定すると図のkとなったも
のとする。閾値kが決定すると、この閾値を用いて図8
に示す濃淡画像を2値化する。つまり、kよりも濃度の
高い画素は“1”になり、kよりも濃度の低い画素は
“0”になる。このようにして、全ての画素を2値化す
ることができる。It is assumed that when the threshold for binarization is determined from this histogram by using the histogram reference method, it becomes k in the figure. When the threshold value k is determined, this threshold value is used in FIG.
The grayscale image shown in is binarized. That is, a pixel having a density higher than k becomes "1", and a pixel having a density lower than k becomes "0". In this way, all pixels can be binarized.
【0004】[0004]
【発明が解決しようとする課題】前述した従来の画像処
理装置では、閾値が一意に決定されてしまうため、周囲
の明るさ等が変化した場合等に、最適な2値化用閾値で
なくなり、好ましい2値化像が得られなくなるという問
題があった。In the above-mentioned conventional image processing apparatus, since the threshold value is uniquely determined, the threshold value is not the optimum threshold value for binarization when ambient brightness changes. There is a problem that a preferable binarized image cannot be obtained.
【0005】本発明はこのような課題に鑑みてなされた
ものであって、周囲の明るさ等が変化しても目的とする
2値画像を得るための2値化用閾値を自動的に設定する
ことができる画像処理装置を提供することを目的として
いる。The present invention has been made in view of the above problems, and automatically sets a binarization threshold value for obtaining a target binary image even if ambient brightness changes. It is an object of the present invention to provide an image processing device capable of performing the above.
【0006】[0006]
【課題を解決するための手段】前記した課題を解決する
本発明は、濃淡画像を入力する画像入力装置と、該画像
入力装置の出力を受けて所定の閾値と比較して2値化
し、2値画像の座標情報と黒画素の長さデータとを出力
するランレングスエンコーダと、該ランレングスエンコ
ーダの出力を受けるプロセッサとで構成された画像処理
装置において、前記プロセッサ内に、目的とする2値画
像の特徴状態を比較データ基準値として記憶する比較デ
ータ記憶部を設け、該プロセッサは2値化された比較デ
ータの値が基準値に一致するように前記ランレングスエ
ンコーダの閾値を順次変化させるようにしたことを特徴
としている。According to the present invention for solving the above-mentioned problems, an image input device for inputting a gray-scale image and an output of the image input device is binarized by comparing it with a predetermined threshold value. An image processing device comprising a run-length encoder that outputs coordinate information of a value image and length data of black pixels, and a processor that receives an output of the run-length encoder. A comparison data storage unit that stores the characteristic state of the image as a comparison data reference value is provided, and the processor sequentially changes the threshold value of the run length encoder so that the value of the binarized comparison data matches the reference value. It is characterized by having done.
【0007】[0007]
【作用】ランレングスエンコーダ内の2値化用閾値を、
2値化後の比較データが目的とする比較データ(基準
値)に近付くように、順次変化させていくようにする。
このように構成することによって、周囲の状況が変化し
ても、比較データの基準値さえ決まっておれば、その比
較データに一致させる方向で閾値を自動的に変化させる
ため、周囲の明るさ等が変化しても目的とする2値画像
を得るための2値化用閾値を自動的に設定することがで
き、常に最適な2値画像を得ることができる。Operation: The threshold for binarization in the run length encoder is
The comparison data after binarization is sequentially changed so as to come close to the target comparison data (reference value).
With this configuration, even if the surrounding conditions change, if the reference value of the comparison data is fixed, the threshold value is automatically changed in the direction to match the comparison data. Even if is changed, a binarization threshold value for obtaining a target binary image can be automatically set, and an optimum binary image can always be obtained.
【0008】[0008]
【実施例】以下、図面を参照して本発明の実施例を詳細
に説明する。図1は本発明の一実施例を示す構成ブロッ
ク図である。図において、1は濃淡画像を入力する画像
入力装置、2は該画像入力装置1の出力を受けて所定の
閾値と比較して2値化し、2値画像の座標情報と黒画素
の長さデータとを出力するランレングスエンコーダであ
る。3は該ランレングスエンコーダ2の出力を受けるプ
ロセッサである。Embodiments of the present invention will now be described in detail with reference to the drawings. FIG. 1 is a configuration block diagram showing an embodiment of the present invention. In the figure, 1 is an image input device for inputting a grayscale image, and 2 is an output of the image input device 1 and is compared with a predetermined threshold value to be binarized. It is a run-length encoder that outputs and. A processor 3 receives the output of the run length encoder 2.
【0009】ランレングスエンコーダ2において、21
は外部信号によりその都度その値が更新される2値化用
閾値を保持する閾値設定部、22は画像入力装置1から
出力される濃淡画像を閾値設定部21より与えられる閾
値で2値化すると共に、2値画像の座標情報と黒画素の
長さデータとを出力する2値化制御部である。プロセッ
サ3において、31は目的とする2値画像の特徴状態を
比較データ基準値として記憶する比較データ記憶部、3
2はランレングスエンコーダ2から出力される比較デー
タと比較データ記憶部に記憶されている基準値との偏差
の許容値を記憶する偏差記憶部である。これら比較デー
タ記憶部31及び偏差記憶部32のデータは、オペレー
タが任意に設定できるようになっている。このように構
成された装置の動作を説明すれば、以下のとおりであ
る。In the run length encoder 2, 21
Is a threshold setting unit that holds a binarization threshold whose value is updated each time by an external signal, and 22 binarizes the grayscale image output from the image input apparatus 1 with the threshold given from the threshold setting unit 21. It is also a binarization control unit that outputs the coordinate information of the binary image and the length data of the black pixels. In the processor 3, 31 is a comparison data storage unit for storing the characteristic state of a target binary image as a comparison data reference value, 3
Reference numeral 2 denotes a deviation storage unit that stores an allowable value of the deviation between the comparison data output from the run length encoder 2 and the reference value stored in the comparison data storage unit. The data in the comparison data storage unit 31 and the deviation storage unit 32 can be arbitrarily set by the operator. The operation of the apparatus configured as described above will be described below.
【0010】ここでは、比較データとして2値画像内の
黒画素の総数を使用する場合を例にとって説明する。そ
して、取込む濃淡画像は図8に示すように複数の画像が
離散的にばらまかれたものではなく、単峰性の画像であ
るものとする。テレビカメラ等の画像入力装置1から出
力される画像出力信号(濃淡画像)は、ランレングスエ
ンコーダ2に入って、2値化符号化され情報圧縮され
る。Here, a case where the total number of black pixels in a binary image is used as the comparison data will be described as an example. The grayscale image to be captured is not an image in which a plurality of images are discretely scattered as shown in FIG. 8, but a monomodal image. An image output signal (grayscale image) output from the image input device 1 such as a television camera enters the run length encoder 2 and is binarized and encoded to compress information.
【0011】具体的には、2値化制御部22が、閾値設
定部21に設定されている閾値と、画像入力装置1から
出力される濃淡画像とを比較し、閾値よりも濃度の高い
画素を“1”(黒)に、閾値よりも濃度の低い画素を
“0”(白)に2値化する。図2はこのようにして2値
化された2値画像の例を示す図である。Specifically, the binarization control unit 22 compares the threshold value set in the threshold value setting unit 21 with the grayscale image output from the image input device 1, and the pixel having a higher density than the threshold value is compared. Is binarized to “1” (black) and pixels having a density lower than the threshold are binarized to “0” (white). FIG. 2 is a diagram showing an example of a binary image binarized in this way.
【0012】2値化制御部22は、図2に示す2値画像
を図3に示すようなフォーマットに編集して出力する。
図2において、斜線で示す領域が黒画素領域である。そ
れぞれの画素はX,Y方向の座標で特定することができ
る。例えば最上段の黒画素は横の連なり(ラン)の長さ
は2であり、最初の座標はX=2,Y=3である。次の
段の黒画素の開始位置はX=3,Y=2でその長さは3
である。以下、同様に編集していくと、図3に示すフォ
ーマットとなる。ランレングス符号化は、黒画素の開始
位置とその長さで表現するので、符号の圧縮を図ること
ができる。The binarization control unit 22 edits the binary image shown in FIG. 2 into a format as shown in FIG. 3 and outputs it.
In FIG. 2, the shaded area is the black pixel area. Each pixel can be specified by the coordinates in the X and Y directions. For example, the black pixel in the top row has a horizontal run length of 2, and the initial coordinates are X = 2 and Y = 3. The start position of the black pixel in the next stage is X = 3, Y = 2 and its length is 3
Is. When the same editing is performed thereafter, the format shown in FIG. 3 is obtained. In the run-length coding, since the start position of the black pixel and its length are used, the code can be compressed.
【0013】図3に示すようなフォーマットのデータは
プロセッサ3に入る。プロセッサ3は、符号化されたデ
ータのうち長さの情報を各ランについて全て加えて2値
画像中の総黒画素数を求める。図3の場合の黒画素数の
総和は12である。プロセッサ3は、ランレングスエン
コーダ2の出力である比較データ12と、比較データ記
憶部31に記憶されている比較データ基準値とを比較
し、ランレングスエンコーダ2の出力である比較データ
が基準値と等しくなるようにランレングスエンコーダ2
内の閾値設定部21の閾値を順次変化させていく。Data in the format shown in FIG. 3 enters the processor 3. The processor 3 adds the length information of the encoded data for each run to obtain the total number of black pixels in the binary image. In the case of FIG. 3, the total number of black pixels is 12. The processor 3 compares the comparison data 12 that is the output of the run length encoder 2 with the comparison data reference value stored in the comparison data storage unit 31, and the comparison data that is the output of the run length encoder 2 becomes the reference value. Run length encoder 2 to be equal
The threshold value of the threshold value setting unit 21 therein is sequentially changed.
【0014】そして、最終的にランレングスエンコーダ
2の出力である比較データが基準値と等しくなった時の
閾値を正式な閾値として2値化する。このような構成を
とることによって、周囲の状況が変化した場合でも周囲
の変化の影響を受けない2値化が可能となる。例えば、
ある状態で比較データを総画素数25と設定した場合、
周囲の状況、例えば明るさが変化したものとする。明る
さが変化しても総画素数は25で変わらないから、変化
後でも総画素数が25になるように自動的に閾値が変化
させられることになる。Finally, the threshold when the comparison data output from the run length encoder 2 becomes equal to the reference value is binarized as a formal threshold. With such a configuration, it is possible to perform binarization that is not affected by changes in the surroundings even when the surroundings change. For example,
When the comparison data is set to 25 total pixels in a certain state,
It is assumed that the surrounding situation, for example, the brightness has changed. Even if the brightness changes, the total number of pixels does not change to 25. Therefore, even after the change, the threshold is automatically changed so that the total number of pixels becomes 25.
【0015】なお、出力比較データが基準値と等しくな
るように2値化閾値を決定するようにすると、繰り返し
回数が増えて実用的でなくなることがある。そのような
場合には、出力データと基準値の偏差がある値以内に収
まったら、2値化閾値決定処理を中止し、その時の閾値
を正式な閾値とするようにしてもよい。即ち、プロセッ
サ3が入力された総黒画素数と比較データ基準値との偏
差を求め、その偏差と偏差記憶部32に記憶されている
基準偏差とを比較する。そして、偏差が基準偏差以内に
なったら処理を中断するのである。このようにすること
により、目的の2値画像に近い状態で画像を2値化する
ことができ、処理も速くなる。If the binarization threshold value is determined so that the output comparison data becomes equal to the reference value, the number of repetitions may increase and it may become impractical. In such a case, if the deviation between the output data and the reference value falls within a certain value, the binarization threshold value determination process may be stopped and the threshold value at that time may be set as the official threshold value. That is, the processor 3 obtains a deviation between the total number of input black pixels and the comparison data reference value, and compares the deviation with the reference deviation stored in the deviation storage unit 32. Then, when the deviation falls within the reference deviation, the processing is interrupted. By doing so, the image can be binarized in a state close to the target binary image, and the processing becomes faster.
【0016】図4乃至図6は本発明による自動2値化決
定シーケンスを示すフローチャートで、プロセッサ3の
動作を示している。先ず、後でその値を使用するため、
2値化の収束範囲(目的の2値画像の総黒画素数に対し
て、収束したと判断するための総黒画素数差の割合。前
記した偏差のこと)をオペレータが設定する(S1)。
次に、初期閾値の仮定があるかどうかチェックし(S
2)、ある場合にはSTEP1は省略してSTEP2に
スキップする。FIGS. 4 to 6 are flow charts showing an automatic binarization decision sequence according to the present invention, and show the operation of the processor 3. First, to use that value later,
The operator sets the binarization convergence range (the ratio of the difference in the total number of black pixels for determining the convergence to the total number of black pixels in the target binary image. The deviation described above) (S1). ..
Next, it is checked whether there is an initial threshold assumption (S
2) In some cases, STEP 1 is omitted and skip to STEP 2.
【0017】初期閾値の仮定とは、以下のような処理を
いう。濃淡レベルの階調の全範囲を、その最大値と最小
値を含んで均等に分割し、それらのレベルでの2値画像
の総黒画素数が、予め比較データ記憶部31に記憶して
おいた目的の2値画像の総黒画素数に最も近い点を捜
す。そして、最も近い点のレベルの閾値を初期閾値とす
るのである。The assumption of the initial threshold value means the following processing. The entire range of gray scale levels is equally divided including the maximum and minimum values, and the total number of black pixels in the binary image at those levels is stored in advance in the comparison data storage unit 31. Find the point that is closest to the total number of black pixels in the desired binary image. Then, the threshold of the level of the closest point is set as the initial threshold.
【0018】初期閾値の仮定がない場合には、均等に分
割した点のレベルの閾値(サンプルレベル)で画像を取
り込み、2値化して総黒画素数を計算する(S3)。次
に、目的とする総黒画素数(基準値)との偏差を計算す
る(S4)。そして、偏差記憶部32に記憶されている
偏差の収束範囲(許容値)以内であるかどうかをチェッ
クし(S5)、偏差が許容値以内になったら、その時の
閾値を新たな閾値として設定し、処理は終了する(S
6)。If there is no assumption of the initial threshold value, the image is taken in by the threshold value (sample level) of the evenly divided points and binarized to calculate the total number of black pixels (S3). Next, the deviation from the target total number of black pixels (reference value) is calculated (S4). Then, it is checked whether or not it is within the convergence range (permissible value) of the deviation stored in the deviation storage unit 32 (S5), and when the deviation is within the permissible value, the threshold value at that time is set as a new threshold value. , The process ends (S
6).
【0019】総黒画素数差(偏差)が収束範囲内でなか
った場合には、総画素数差がそれまでの最小であるかど
うかチェックする(S7)。そして、最小であった場合
には、その時の閾値,総黒画素数,総黒画素数差(偏
差)を更新して記憶しておく(S8)。最小でなかった
場合にはS8はスキップする。次に、各サンプルレベル
での画像取込みが終了したかどうかチェックし(S
9)、終了している場合にはSTEP2に進み、終了し
ていない場合には、S3に戻って画像取込み処理を続行
する。When the total black pixel number difference (deviation) is not within the convergence range, it is checked whether or not the total pixel number difference is the smallest so far (S7). If it is the minimum, the threshold value, the total number of black pixels, and the total black pixel number difference (deviation) at that time are updated and stored (S8). If it is not the minimum, S8 is skipped. Next, it is checked whether the image acquisition at each sample level is completed (S
9) If it is finished, the process proceeds to STEP2. If it is not finished, the process returns to S3 to continue the image capturing process.
【0020】STEP2では、STEP1で得られた
(閾値−1)のレベルを新たな閾値として画像取込み、
2値化,総黒画素数計算を行う(S10)。次に、2値
化処理により得られた総黒画素数と比較データ記憶部3
1に記憶されている基準値との偏差(黒画素数差)を計
算する(S11)。このようにして得られた総黒画素数
差と偏差記憶部32に記憶されている許容差とを比較
し、収束範囲内であるかどうかチェックする(S1
2)。収束範囲内であった場合には、その時の閾値を新
たな閾値として設定し、処理は終了する(S6)。In STEP 2, the level of (threshold value -1) obtained in STEP 1 is used as a new threshold value to capture an image,
Binarization and total black pixel number calculation are performed (S10). Next, the total number of black pixels obtained by the binarization process and the comparison data storage unit 3
The deviation (difference in the number of black pixels) from the reference value stored in 1 is calculated (S11). The total black pixel number difference thus obtained is compared with the allowable difference stored in the deviation storage unit 32 to check whether or not it is within the convergence range (S1).
2). If it is within the convergence range, the threshold value at that time is set as a new threshold value, and the process ends (S6).
【0021】若し、それでも収束範囲内でなかった場合
には、今度はS10とは逆にSTEP1で得られた(閾
値+1)のレベルを新たな閾値として画像取込み、2値
化,総黒画素数計算を行う(S13)。次に、2値化処
理により得られた総黒画素数と比較データ記憶部31に
記憶されている基準値との偏差(黒画素数差)を計算す
る(S14)。このようにして得られた総黒画素数差が
偏差記憶部32に記憶されている許容差を比較し、収束
範囲内であるかどうかチェックする(S15)。収束範
囲内であった場合には、その時の閾値を新たな閾値とし
て設定し、処理は終了する(S6)。If it is not within the convergence range, this time, contrary to S10, the level of (threshold value +1) obtained in STEP 1 is used as a new threshold value for image capture, binarization, and total black pixels. The number is calculated (S13). Next, the deviation (black pixel number difference) between the total number of black pixels obtained by the binarization process and the reference value stored in the comparison data storage unit 31 is calculated (S14). The total black pixel number difference thus obtained is compared with the tolerance stored in the deviation storage unit 32 to check whether it is within the convergence range (S15). If it is within the convergence range, the threshold value at that time is set as a new threshold value, and the process ends (S6).
【0022】総黒画素数差が収束範囲内でなかった場合
には、STEP2で処理した結果得られた総黒画素数差
がそれまでの最小であるかどうかチェックする(S1
7)。そして、前後の点で総黒画素数差が最小となった
場合には、閾値変化量を+1(S18)又は−1(S1
9)と設定する。つまり、(閾値−1)で2値化した時
に総黒画素数差が最小となった場合には閾値変化量を−
1と設定し、(閾値+1)で2値化した時に総黒画素数
差が最小となった場合には閾値変化量を+1と設定する
のである。若し、STEP1で求めた黒画素数差よりも
小さくならなかった場合には、STEP1で求めた閾値
を正式な閾値として設定し、処理を終了する(S6)。
収束範囲内には収まっていないが、その時の閾値を最適
な閾値であると判定するものである。以上の処理が終了
したら、閾値,総黒画素数,総黒画素数差を更新する
(S20)。If the total black pixel number difference is not within the convergence range, it is checked whether or not the total black pixel number difference obtained as a result of processing in STEP 2 is the smallest so far (S1).
7). Then, when the difference between the total number of black pixels is the smallest at the points before and after, the threshold change amount is set to +1 (S18) or -1 (S1).
9). That is, when the difference in the total number of black pixels is minimized when binarizing with (threshold value -1), the threshold change amount is set to
If the total black pixel number difference is minimized when the value is set to 1 and binarized by (threshold value + 1), the threshold value change amount is set to +1. If it does not become smaller than the difference in the number of black pixels calculated in STEP1, the threshold calculated in STEP1 is set as the official threshold, and the process ends (S6).
Although it is not within the convergence range, the threshold value at that time is determined to be the optimum threshold value. When the above processing is completed, the threshold value, the total number of black pixels, and the total black pixel number difference are updated (S20).
【0023】STEP3では、STEP2で得られた閾
値の変化量を加えながら、総黒画素数を繰り返し計算す
る。即ち、総黒画素数が最小となるレベルが見つかる間
は、繰り返し閾値を変化させながら、2値画像を取込ん
でその時の閾値,総黒画素数,総黒画素数差を更新し続
ける。最小となるレベルが見つからなかったら、その点
の前の点のレベルが最適2値化閾値であると判断する。
この処理の間に、総黒画素数差(偏差)が初めに定めた
収束範囲内に入ったら、その点のレベルを最適2値化閾
値とするものである。In step 3, the total number of black pixels is repeatedly calculated while adding the amount of change in the threshold value obtained in step 2. That is, while the level at which the total number of black pixels is minimized is found, the binary image is captured while repeatedly changing the threshold value, and the threshold value, total black pixel number, and total black pixel number difference at that time are continuously updated. If the minimum level is not found, it is determined that the level of the point before that point is the optimum binarization threshold.
During this process, if the total black pixel number difference (deviation) falls within the initially defined convergence range, the level at that point is set as the optimum binarization threshold.
【0024】具体的には、STEP2で求めた閾値の変
化量を閾値設定部21に加え(S21)、変化後の閾値
で画像取込み,総黒画素数を計算する(S22)。次
に、目的とする2値画像の総黒画素数差を計算する(S
23)。次に、総黒画素数差が収束範囲内であるかどう
かチェックし(S24)、そうであった場合にはその時
の閾値を正式な閾値として設定し処理は終了する(S
6)。Specifically, the amount of change in the threshold value obtained in STEP 2 is added to the threshold value setting section 21 (S21), the image is captured with the changed threshold value, and the total number of black pixels is calculated (S22). Next, the difference in the total number of black pixels of the target binary image is calculated (S
23). Next, it is checked whether or not the total black pixel number difference is within the convergence range (S24), and if so, the threshold value at that time is set as a formal threshold value and the process ends (S24).
6).
【0025】収束範囲内でなかった場合には、総黒画素
数差がいままでの最小のものより小さいかどうかチェッ
クし(S25)、小さい場合には閾値,総黒画素数,総
黒画素数差を更新し(S26)、S21に戻る。このよ
うにして、閾値を最適な値に追込んでいく。若し、S2
5で今までの総黒画素数差よりも小さくなかった場合に
は、その前の設定値がより最適であることから、その時
の閾値を正式な閾値として設定し、処理を終了する(S
6)。以上の処理を行うことにより、目的とする2値画
像の状態に最も近い2値画像を得るための最適2値化閾
値を求めることができる。If the difference is not within the convergence range, it is checked whether the difference in the total number of black pixels is smaller than the smallest one so far (S25). The difference is updated (S26), and the process returns to S21. In this way, the threshold value is adjusted to the optimum value. S2
If it is not smaller than the total black pixel number difference up to now, since the previous setting value is more optimal, the threshold value at that time is set as a formal threshold value, and the process ends (S
6). By performing the above processing, the optimum binarization threshold value for obtaining the binary image closest to the target binary image state can be obtained.
【0026】上述の実施例では、2値画像の総黒画素数
を比較データとして用いた場合を例にとって説明した
が、本発明はこれに限るものではない。代わりに2値画
像の不一致画素数の総和を使用するようにしてもよい
(但し、この場合には毎回の画像取込み時に、対象物体
のカメラの画面内の相対的な位置がほぼ等しい場合に限
られるので、物体認識等には応用できない。また分散し
た画像の集合体にも適用できない)。In the above-described embodiment, the case where the total number of black pixels of the binary image is used as the comparison data has been described as an example, but the present invention is not limited to this. Instead, the sum of the number of mismatched pixels of the binary image may be used (however, in this case, only when the relative position of the target object on the screen of the camera is almost the same at each image capture). Therefore, it cannot be applied to object recognition, etc., nor can it be applied to a collection of dispersed images).
【0027】図7は2値画像の不一致画素の総数を求め
る場合の説明図である。画像Aと画像Bとの不一致画素
は、(X,Y)=(3,5),(4,5)の2個であ
る。画像Aを目的とする2値画像とすると、不一致画素
数の総和“2”を比較データとして用いるのである。こ
の方法を用いた場合、比較する2つの2値画像の画面内
に対する相対的な位置がほぼ一致しているなら、比較デ
ータとして2値画像の総画素数を用いた場合に比較し
て、より正確な自動2値化が可能になる。FIG. 7 is an explanatory diagram for obtaining the total number of mismatched pixels of a binary image. The number of non-matching pixels between the image A and the image B is two (X, Y) = (3, 5), (4,5). When the image A is a target binary image, the total sum "2" of the number of mismatched pixels is used as comparison data. When this method is used, if the relative positions of the two binary images to be compared with each other in the screen are substantially the same, compared to the case where the total number of pixels of the binary image is used as the comparison data, Accurate automatic binarization is possible.
【0028】また、図4のSTEP1段階で、STEP
2の処理を行うための閾値の初期値を入力しておけば、
STEP1の処理が全く不要となるため、最適閾値に収
束するまでの時間(STEP2とSTEP3の処理時間
の合計)が短くなるので、更に実用的となる。In step 1 of FIG. 4, step 1
If you input the initial value of the threshold for performing the process of 2,
Since the processing of STEP1 is completely unnecessary, the time until the convergence to the optimum threshold value (the total processing time of STEP2 and STEP3) is shortened, which is more practical.
【0029】[0029]
【発明の効果】以上、詳細に説明したように、本発明に
よれば周囲の状況が変わった場合でも、予め2値画像の
特徴を示すための比較データを基準値として設定してお
き、2値化処理により得られた2値画像の比較データが
基準値に近づくように2値化用閾値を可変することによ
り、最適な閾値を自動的に設定することができる画像処
理装置を提供することができる。また、本発明によれば
処理機能をソフトウェアで実現することができるため、
コストの低減を図ることができる。As described above in detail, according to the present invention, the comparison data for indicating the characteristics of the binary image is set in advance as the reference value even when the surrounding situation changes. To provide an image processing device capable of automatically setting an optimum threshold value by varying a binarization threshold value so that comparison data of a binary image obtained by the binarization processing approaches a reference value. You can Further, according to the present invention, since the processing function can be realized by software,
The cost can be reduced.
【0030】また、自動2値化を行うための目的の画像
の2値化像の状態を、その比較データとして対比させる
ことにより、従来濃淡レベルの階調毎の画素数を積算し
たヒストグラムを用いる方法では不可能であった自動2
値化のための基準画像状態を任意に設定することができ
る。更に、本発明を用いれば、周囲の明るさ等の環境の
変化に左右されることなく、画像の2値化が可能となる
ので、その後に2値画像を用いた画像計測,画像処理等
の各種作業を行う上で都合がよい。Further, by comparing the state of the binarized image of the target image for automatic binarization as the comparison data, a histogram obtained by integrating the number of pixels for each gray level of the conventional gray level is used. Automatic 2 which was impossible by the method
The reference image state for binarization can be set arbitrarily. Furthermore, by using the present invention, it is possible to binarize an image without being affected by changes in the environment such as ambient brightness, so that after that, image measurement using a binary image, image processing, etc. It is convenient for performing various operations.
【図1】本発明の一実施例を示す構成ブロック図であ
る。FIG. 1 is a configuration block diagram showing an embodiment of the present invention.
【図2】2値化された2値画像の例を示す図である。FIG. 2 is a diagram showing an example of a binarized binary image.
【図3】2値画像の出力フォーマット例を示す図であ
る。FIG. 3 is a diagram showing an output format example of a binary image.
【図4】本発明による自動2値化決定シーケンスを示す
フローチャートである。FIG. 4 is a flowchart showing an automatic binarization determination sequence according to the present invention.
【図5】本発明による自動2値化決定シーケンスを示す
フローチャートである。FIG. 5 is a flowchart showing an automatic binarization determination sequence according to the present invention.
【図6】本発明による自動2値化決定シーケンスを示す
フローチャートである。FIG. 6 is a flowchart showing an automatic binarization determination sequence according to the present invention.
【図7】2値画像の不一致画素の総数を求める場合の説
明図である。FIG. 7 is an explanatory diagram for obtaining the total number of mismatched pixels in a binary image.
【図8】濃淡画像の例を示す図である。FIG. 8 is a diagram showing an example of a grayscale image.
【図9】濃淡画像の濃淡レベルのヒストグラム例を示す
図である。FIG. 9 is a diagram showing an example of a histogram of a gray level of a gray image.
1 画像入力装置 2 ランレングスエンコーダ 3 プロセッサ 21 閾値設定部 22 2値化制御部 31 比較データ記憶部 32 偏差記憶部 1 Image Input Device 2 Run Length Encoder 3 Processor 21 Threshold Setting Unit 22 Binarization Control Unit 31 Comparison Data Storage Unit 32 Deviation Storage Unit
Claims (3)
画像入力装置の出力を受けて所定の閾値と比較して2値
化し、2値画像の座標情報と黒画素の長さデータとを出
力するランレングスエンコーダと、該ランレングスエン
コーダの出力を受けるプロセッサとで構成された画像処
理装置において、 前記プロセッサ内に、目的とする2値画像の特徴状態を
比較データ基準値として記憶する比較データ記憶部を設
け、該プロセッサは2値化された比較データの値が基準
値に一致するように前記ランレングスエンコーダの閾値
を順次変化させるようにしたことを特徴とする画像処理
装置。1. An image input device for inputting a gray-scale image, and binarizes the output of the image input device by comparing it with a predetermined threshold value and binarizes coordinate information of the binary image and length data of black pixels. In an image processing apparatus including an output run-length encoder and a processor receiving the output of the run-length encoder, comparison data storing a characteristic state of a target binary image as a comparison data reference value in the processor. An image processing apparatus comprising a storage unit, wherein the processor sequentially changes the threshold value of the run-length encoder so that the value of the binarized comparison data matches a reference value.
コーダ出力の出力比較データと比較データ記憶部に記憶
されている基準値との偏差の許容値を記憶する偏差記憶
部を設け、2値化された比較データと基準値との偏差が
該許容値以内になったら、その時の閾値を正式な閾値と
して符合化するようにしたことを特徴とする請求項1記
載の画像処理装置。2. The processor is provided with a deviation storage section for storing an allowable value of a deviation between the output comparison data of the run length encoder output and the reference value stored in the comparison data storage section, and binarized. The image processing apparatus according to claim 1, wherein when the deviation between the comparison data and the reference value is within the allowable value, the threshold value at that time is encoded as a formal threshold value.
目的とする2値画像との黒画素の不一致画素数の総和を
用いたことを特徴とする請求項1記載の画像処理装置。3. The image processing apparatus according to claim 1, wherein the comparison data is a total number of black pixels or a total number of black pixels that do not match a target binary image.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3249983A JPH0591326A (en) | 1991-09-30 | 1991-09-30 | Picture processing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP3249983A JPH0591326A (en) | 1991-09-30 | 1991-09-30 | Picture processing device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0591326A true JPH0591326A (en) | 1993-04-09 |
Family
ID=17201086
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP3249983A Pending JPH0591326A (en) | 1991-09-30 | 1991-09-30 | Picture processing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0591326A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20010110858A (en) * | 2000-06-08 | 2001-12-15 | 김성식 | Binary Image CODEC for Mobile Communication |
| WO2005045775A1 (en) * | 2003-11-07 | 2005-05-19 | Axonx, L.L.C. | Smoke detection method and apparatus |
-
1991
- 1991-09-30 JP JP3249983A patent/JPH0591326A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20010110858A (en) * | 2000-06-08 | 2001-12-15 | 김성식 | Binary Image CODEC for Mobile Communication |
| WO2005045775A1 (en) * | 2003-11-07 | 2005-05-19 | Axonx, L.L.C. | Smoke detection method and apparatus |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US4941192A (en) | Method and apparatus for recognizing pattern of gray level image | |
| KR102361444B1 (en) | System and method of quality adjustment of object detection based on polyggon | |
| CN111031359B (en) | Video playing method and device, electronic equipment and computer readable storage medium | |
| US6333788B1 (en) | Image processing apparatus and method | |
| US11902533B2 (en) | Code rate control method and apparatus, image acquisition device, and readable storage medium | |
| JP5870745B2 (en) | Image processing apparatus, binarization threshold value calculation method, and computer program | |
| EP0424854B1 (en) | Image processing apparatus for binarizing halftone image data by using an adaptive threshold | |
| KR100514169B1 (en) | Method of aligning wafer and Apparatus of the same | |
| CN112241737B (en) | Text and image correction method and device | |
| JPH0591326A (en) | Picture processing device | |
| JP2871601B2 (en) | Character string detecting apparatus and method | |
| CN118470056A (en) | Image segmentation method and device based on threshold processing, electronic equipment and storage medium | |
| CN117474932A (en) | Object segmentation method and device, electronic equipment and storage medium | |
| JP2628863B2 (en) | Visual recognition device | |
| JP3876584B2 (en) | Image detection apparatus and image detection method | |
| JP2859603B2 (en) | Method and apparatus for binarizing image data | |
| CN109348203B (en) | Method for obtaining resolution of YUV image and electronic equipment | |
| JP2859936B2 (en) | Image information processing device | |
| JPH07230549A (en) | Image processor and its method | |
| JP2606498B2 (en) | Fingerprint image input device | |
| KR100416254B1 (en) | Appatatus for detecting high frequency elements from image data and method thereof | |
| JP3355234B2 (en) | Image binarization device | |
| JPS58184684A (en) | Deciding method of binarized slice value | |
| JP2527482B2 (en) | Image processing device | |
| JP2000137820A (en) | Image processing apparatus and method, and providing medium |