JPH05282443A - Image processing method - Google Patents

Image processing method

Info

Publication number
JPH05282443A
JPH05282443A JP4105789A JP10578992A JPH05282443A JP H05282443 A JPH05282443 A JP H05282443A JP 4105789 A JP4105789 A JP 4105789A JP 10578992 A JP10578992 A JP 10578992A JP H05282443 A JPH05282443 A JP H05282443A
Authority
JP
Japan
Prior art keywords
image
area
wood
section
coordinate
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
Application number
JP4105789A
Other languages
Japanese (ja)
Inventor
Tatsuji Miura
達司 三浦
Yukio Hioki
幸男 日置
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.)
Hitachi Zosen Corp
Original Assignee
Hitachi Zosen 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 Hitachi Zosen Corp filed Critical Hitachi Zosen Corp
Priority to JP4105789A priority Critical patent/JPH05282443A/en
Publication of JPH05282443A publication Critical patent/JPH05282443A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Analysis (AREA)

Abstract

PURPOSE:To provide an image processing method capable of calculating the area and the center of gravity of an object accurately and in a short time by using an original image from a television camera by which the object is photographed. CONSTITUTION:The minimum image area including only the image of the object can be specified (3) by binarizing (2) the original image from the television camera photographing the object by using two threshold values for brightness, and setting the threshold values on the number of accumulated picture elements in a Y-axial direction and an X-axial direction for the X-axis and the Y-axis of a binarized image. Thence, a part lost by binarization can be filled by scanning each straight line on both coordinates in a specified image area by the minimum value and the maximum value of the image area, and assuming a part between both coordinates arriving first to the image of the object as the area of the object, and also, the area and the center of gravity can be calculated (4) from the image of the object.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、テレビカメラより出力
された対象物の原画像からこの対象物の面積及び重心を
求めるための画像処理方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image processing method for obtaining an area and a center of gravity of an object from an original image of the object output from a television camera.

【0002】[0002]

【従来の技術】従来より、例えば製材所においては、鋸
盤を自動化するための画像処理装置が運用され、鋸盤に
よる製材に必要な芯出しと木割りを行うために、木材断
面の重心と面積との計算をテレビカメラで撮映した木材
断面画像から求めることが行われている。
2. Description of the Related Art Conventionally, for example, in a sawmill, an image processing device for automating a saw machine has been operated, and in order to perform centering and wood cutting required for sawmilling, the center of gravity of a wood cross section The calculation of the area is carried out from the wood cross-section image projected by the TV camera.

【0003】従来の画像処理装置においては、背景と木
材断面とを含むテレビカメラからの原画像に対しその明
るさを数値によってあらわし、木材断面と背景とが分離
するような境界となる数値つまり閾値を設定することに
より、その閾値より明るい部分もしくは暗い部分を木材
断面の2値化画像としている。そして、2値化された画
像に対し、あらかじめ設定した領域に木材断面が含まれ
るものとして、この領域全体に分布する全ての明るい部
分のみを使ってその画像における重心と面積とを計算す
るようにしている。
In a conventional image processing apparatus, the brightness of an original image from a TV camera including a background and a wood cross section is represented by a numerical value, and a numerical value or a threshold value is defined as a boundary at which the wood cross section and the background are separated. By setting, a portion brighter or darker than the threshold value is set as a binarized image of the wood cross section. Then, regarding the binarized image, it is assumed that the wood cross section is included in the preset region, and the center of gravity and the area in the image are calculated using only all the bright portions distributed in this region. ing.

【0004】[0004]

【発明が解決しようとする課題】しかしながら、テレビ
カメラからの原画像においては、木材断面より明るい背
景及び暗い背景を含むのが普通であり、前述したように
単に1つの閾値で木材断面を分離して2値化する方法で
は、木材断面の2値化画像に背景が含まれてしまう問題
を生じる。
However, in the original image from the TV camera, it is common to include a lighter background and a darker background than the wood section, and as described above, the wood section is separated by only one threshold value. The method of binarizing by using the method causes a problem that the binarized image of the wood cross section includes the background.

【0005】その上、2値化画像のあらかじめ設定した
領域に必らず木材断面が含まれるようにするためには、
この領域を比較的大きく設定しておく必要があるが、こ
の結果、前記領域内により多くの背景が含まれてしま
い、木材断面の面積,重心の計算に悪影響を与えやす
く、しかも、この比較的大きな領域を対象にして木材断
面の検出とその面積,重心の計算とを行うため、これら
の処理に時間がかかるといった問題を生じる。
Moreover, in order to ensure that the wood cross section is included in the preset area of the binarized image,
It is necessary to set this area relatively large, but as a result, more background is included in the area, which tends to adversely affect the calculation of the area of the wood cross section and the center of gravity. Since the detection of the wood cross section and the calculation of the area and the center of gravity of the large area are performed, there arises a problem that the processing takes time.

【0006】さらに、、木材が屋外に保管されていた場
合には、木材断面が雨,砂等により汚損,変色し、これ
を撮映したテレビカメラの画像においても木材断面に部
分的な変色を生じ、したがって、2値化によって得られ
た画像においては木材断面が部分的に欠落したものとな
るが、従来の方法では、この欠落した部分は欠落したま
ま処理されるため、重心,面積の計算結果の信頼性が低
い問題がある。
Furthermore, when the wood is stored outdoors, the cross section of the wood is soiled and discolored by rain, sand, etc., and even in the image of a television camera which shoots this, the wood cross section is partially discolored. Therefore, in the image obtained by binarization, the wood cross section is partially missing. However, in the conventional method, this missing part is processed while it is missing, so the calculation of the center of gravity and area is performed. There is a problem that the reliability of the result is low.

【0007】本発明は、従来の技術の有するこのような
問題点に留意してなされたものであり、その目的とする
ところは、テレビカメラからの原画像から対象物の画像
を正確に測定でき、部分的な欠落がある場合であっても
これを補正してより正確かつ短時間に面積,重心の算出
が行える画像処理方法を提供することにある。
The present invention has been made in view of the above problems of the prior art, and an object of the present invention is to accurately measure an image of an object from an original image from a television camera. An object of the present invention is to provide an image processing method capable of more accurately and quickly calculating the area and the center of gravity by correcting even if there is a partial omission.

【0008】[0008]

【課題を解決するための手段】前記目的を達成するため
に、本発明の画像処理方法においては、対象物を撮映し
たテレビカメラからの原画像を背景と対象物とを分離す
る2つの明るさの閾値を設定して2値化し、2値化され
た画像のX座標に対するY軸方向の累積画素数及びY座
標に対するX軸方向の累積画素数に対しそれぞれ閾値を
設定して対象物画像のみを取り出すと共に、この対象物
画像のみを含む最小の画像領域を特定し、特定された画
像領域における各Y座標上の直線及び各X座標上の直線
に対し、画像領域の最小値と最大値とからそれぞれ走査
して最初に前記対象物画像に到達した両座標間を対象物
の領域とみなして2値化によって失なわれた部分を穴埋
めし、穴埋めによって補正された対象物画像から面積及
び重心を算出するものである。
In order to achieve the above-mentioned object, in the image processing method of the present invention, an original image from a television camera which images an object is divided into two brightnesses for separating the background and the object. Threshold value is set and binarized, and the threshold value is set for the cumulative number of pixels in the Y axis direction with respect to the X coordinate and the cumulative number of pixels in the X axis direction with respect to the Y coordinate of the binarized image. And the minimum image area including only this object image is specified, and the minimum value and the maximum value of the image area with respect to the straight line on each Y coordinate and the straight line on each X coordinate in the specified image region. Areas of the object that are lost by the binarization are filled by considering the area between the two coordinates that first reach the object image by scanning from and, and the area and the area are calculated from the object image corrected by the hole filling. Calculate the center of gravity Than it is.

【0009】[0009]

【作用】本発明の画像処理方法によれば、テレビカメラ
からの原画像を2値化する場合に2つの閾値を用い、こ
の閾値によって挟まれた部分又は挟まれなかった部分を
対象物の画像とするため、可能な限り対象物の画像に背
景を含まないようにできる。
According to the image processing method of the present invention, two threshold values are used when binarizing an original image from a television camera, and a portion sandwiched by these thresholds or a portion not sandwiched by the thresholds is an image of the object. Therefore, the background of the image of the object can be excluded as much as possible.

【0010】そして、2値化された画像に対し、X軸方
向及びY軸方向の累積画素数を求めてこれから対象物画
像のみを取り出し、これを含む最小画像領域を特定する
ため、2値化によって分離できない背景による面積,重
心の計算に与える悪影響を抑えることができ、しかも、
特定された最小限の画像領域だけを計算の対象とするた
め、計算時間の短縮につながる。
Then, for the binarized image, the cumulative number of pixels in the X-axis direction and the Y-axis direction is calculated, and only the object image is extracted from this, and the minimum image area including this is binarized in order to specify it. It is possible to suppress the adverse effect on the calculation of the area and the center of gravity due to the background that cannot be separated by
Since only the specified minimum image area is targeted for calculation, the calculation time can be shortened.

【0011】さらに、特定された画像領域において、各
Y座標上の直線及び各X座標上の直線をそれぞれ画像領
域の最小値と最大値とから走査してこの直線上の対象物
画像の両側間を対象物領域とみなすため、2値化によっ
て失なわれた部分を補うことが可能となり、対象物の面
積及び重心の計算結果がより正確なものになる。
Further, in the specified image area, a straight line on each Y coordinate and a straight line on each X coordinate are scanned from the minimum value and the maximum value of the image area, respectively, and between the both sides of the object image on this straight line. Is regarded as the object region, it is possible to compensate for the part lost by the binarization, and the calculation results of the area and the center of gravity of the object become more accurate.

【0012】[0012]

【実施例】実施例につき、図1ないし図10を用いて説
明する。まず、図2は自動鋸盤用画像処理装置の概略構
成を示したものであり、1は対象物となる木材、2は木
材1の両端面をそれぞれ撮映する小型CCDカメラ等か
らなる2台のテレビカメラ、3はカメラインターフェー
スであり、CPU4の指示に従って両テレビカメラ2の
切り替えやシェージング処理,画像の2値化,木取りパ
ターンとテレビカメラ2からの画像との重ね合わせ,文
字データの重ね書き等を行い、テレビ映像信号に変換し
て出力する。
EXAMPLES Examples will be described with reference to FIGS. 1 to 10. First, FIG. 2 shows a schematic configuration of an image processing apparatus for an automatic saw machine, in which 1 is wood as an object, 2 is two compact CCD cameras which image both end faces of the wood 1, respectively. TV camera 3 is a camera interface, and switching between both TV cameras 2 and shading processing, binarization of an image, superposition of a wood removal pattern and an image from the TV camera 2, and overwriting of character data are performed in accordance with instructions from the CPU 4. Etc., and converts into a TV video signal and outputs.

【0013】5はカメラインターフェース3からのテレ
ビ映像信号を表示するカラー画像表示用のテレビモニタ
であり、モニタ画面には、テレビカメラ2でとらえた木
材端部の画像,木取りパターン,文字等が表示される。
Reference numeral 5 is a television monitor for displaying a color image for displaying a television video signal from the camera interface 3. The monitor screen displays an image of the end of the timber captured by the television camera 2, a wood removal pattern, characters and the like. To be done.

【0014】前記CPU4は、画像処理部全体の動作を
制御すると共に、CPU4のメモリにあらかじめ記憶さ
れた木取りパターン情報に基きカメラインターフェース
3へ木取りパターンの書き込みや図外の制御装置への木
取りデータの出力を行い、かつ、画像から木材1の重心
と面積との計算を行う。
The CPU 4 controls the operation of the entire image processing unit, writes the wood removal pattern to the camera interface 3 based on the wood removal pattern information stored in advance in the memory of the CPU 4, and outputs the wood removal data to a control device (not shown). The output is performed, and the center of gravity and the area of the wood 1 are calculated from the image.

【0015】6は位置検出器であり、2値化された画像
の重心位置をテレビモニタ5の画面上の座標として検出
し、CPU4に対して座標データを供給する。7はデジ
タル入出力装置としての入出力インターフェースであ
り、CPU4がこれを介して操作スイッチの状態を調べ
たり、表示灯を点滅させ、あるいはプリンタ8に印字デ
ータを出力する。9は電源ユニットである。
A position detector 6 detects the position of the center of gravity of the binarized image as coordinates on the screen of the television monitor 5, and supplies coordinate data to the CPU 4. Reference numeral 7 denotes an input / output interface as a digital input / output device through which the CPU 4 checks the state of the operation switch, blinks an indicator light, or outputs print data to the printer 8. 9 is a power supply unit.

【0016】また、図1は前記画像処理装置における面
積,重心の計算のための処理をフローチャートで示した
ものであり、画像入力、2値化、木材領域の特
定、及び木材領域内の面積,重心計算の各処理過程か
らなる。
FIG. 1 is a flow chart showing the process for calculating the area and the center of gravity in the image processing apparatus. Image input, binarization, identification of a wood area, and area in the wood area, It consists of each process of calculating the center of gravity.

【0017】画像入力 テレビカメラ2により木材1の端面を撮影し、テレビカ
メラ2からの映像信号にシェージング処理を施し、すな
わち像信号にシェージング信号を重ねて映像信号を補正
し、図3に示すような原画像を得る。この原画像におい
て、A,Cは背景、Bは木材断面であり、ここで、図3
における直線L−L上の明るさ分布を示した図4のよう
に、背景A,木材断面B,背景Cの順に明るさが大きい
ものとする。
Image input: The end face of the wood 1 is photographed by the TV camera 2, and the image signal from the TV camera 2 is subjected to shading processing, that is, the image signal is superimposed on the image signal to correct the image signal, and as shown in FIG. Get the original image. In this original image, A and C are backgrounds and B is a wood cross section.
As shown in FIG. 4, which shows the brightness distribution on the straight line L-L, the brightness increases in the order of the background A, the wood section B, and the background C.

【0018】2値化 得られた原画像に対し、図4に示すように、木材断面B
と背景A,Cとを分離する2つの明るさの異なる閾値
a,bを設定し、この閾値a,bで挟まれた部分を1、
それ以外を0として2値化し、木材断面Bの部分の明る
さのみを取り出すようにする。
Binarization As shown in FIG. 4, a wood cross section B is applied to the obtained original image.
And the backgrounds A and C are separated from each other, two thresholds a and b having different brightness are set, and the portion sandwiched between the thresholds a and b is set to 1,
Other values are set to 0 and binarized so that only the brightness of the wood cross section B is extracted.

【0019】従来では、原画像の2値化に際して1つの
閾値,例えばaのみを設定していたため、2値化によっ
て得られた画像には、図5の(A)のように木材断面B
とこれより明るい背景Cとが含まれることになるが、前
述のように2つの閾値a,bを設定することにより、図
5の(B)のように、木材断面に可能な限り背景を含ま
ないようにすることができる。
Conventionally, only one threshold value, for example, a, was set when binarizing the original image, so that the image obtained by binarizing the wood cross section B as shown in FIG.
And the background C brighter than this are included, but by setting the two threshold values a and b as described above, the background is included as much as possible in the wood cross section as shown in FIG. 5B. You can avoid it.

【0020】ここで、図6は前記原画像における画面上
の画素数と明るさとの関係を示したものであり、図中の
A,B,Cはそれぞれ原画像における背景A,木材断面
B,背景Cに対応しており、2つの明るさの閾値a,b
で木材断面Bを取り出せることがわかる。なお、木材断
面Bより明るい背景Cは、その周縁が閾値a,b間の明
るさになることから、図5の(B)に示すように、背景
Cの輪郭のみが2値化画像として残ることがある。
Here, FIG. 6 shows the relationship between the number of pixels on the screen and the brightness in the original image, where A, B, and C in the figure are the background A, the wood section B, and B in the original image, respectively. It corresponds to the background C and has two brightness thresholds a and b.
It can be seen that the wood section B can be taken out with. Note that the background C brighter than the wood cross section B has the brightness between the thresholds a and b at the periphery, so that only the outline of the background C remains as a binarized image as shown in FIG. 5B. Sometimes.

【0021】木材領域の特定 図7は前述のようにして得られた2値化画像を示したも
のであり、図中、Dは画像全体、Eは木材の支持テーブ
ルによって移動する木材断面Bの最大移動範囲、Fは木
材断面Bに外接する四角形つまり木材断面のみを含む最
小の木材領域である。また、図8の(A)は、図7の2
値化画像において、X座標に対するY軸方向の累積画素
数を表わしたものであり、図8の(B)は、同じくY座
標に対するX軸方向の累積画素数を表わしたものであ
る。
Identification of Wood Region FIG. 7 shows a binarized image obtained as described above, in which D is the whole image and E is the cross section B of the wood moving by the support table of wood. The maximum movement range, F, is a quadrangle circumscribing the wood section B, that is, the minimum wood area including only the wood section. In addition, (A) of FIG.
In the binarized image, it shows the cumulative number of pixels in the Y-axis direction with respect to the X coordinate, and FIG. 8B shows the cumulative number of pixels in the X-axis direction with respect to the Y coordinate.

【0022】図8の(A)において、木材断面Bと背景
Cとを分離するある閾値cを設定し、移動範囲EのX座
標における最小値X1 から最大値X2 及び最大値X2
ら最小値X1 に向ってそれぞれ走査し、最初に閾値cを
越えたX座標X1',X2'をそれぞれ木材領域FのX座標
の最小値,最大値とする。
In FIG. 8A, a certain threshold value c for separating the wood section B and the background C is set, and from the minimum value X 1 to the maximum value X 2 and the maximum value X 2 in the X coordinate of the moving range E. Scanning is performed toward the minimum value X 1 , and the X-coordinates X 1 'and X 2 ' that first exceed the threshold value c are set as the minimum and maximum X-coordinates of the wood region F, respectively.

【0023】同様に、図8の(B)において、木材断面
Bと背景Cとを分離するある閾値dを設定し、移動範囲
EのY座標における最小値Y1 から最大値Y2 及び最大
値Y2 から最小値Y1 に向ってそれぞれ走査し、最初に
閾値dを越えたY座標Y1',Y2'をそれぞれ木材領域F
のY座標の最小値,最大値とする。これにより、2値化
画像から木材断面Bのみを取り出してこの木材断面Bの
みを含む最小の画像領域すなわち木材領域Fを特定でき
る。なお、前記閾値c,dはできるだけ小さな値にする
ことが望ましい。
Similarly, in FIG. 8B, a certain threshold value d for separating the wood section B and the background C is set, and the minimum value Y 1 to the maximum value Y 2 and the maximum value in the Y coordinate of the moving range E are set. Scanning is performed from Y 2 toward the minimum value Y 1 , and first, Y coordinates Y 1 'and Y 2 ' that exceed the threshold value d are respectively detected in the wood region F.
The minimum and maximum Y-coordinates of This makes it possible to extract only the wood section B from the binarized image and specify the minimum image area including only the wood section B, that is, the wood area F. It is desirable that the threshold values c and d be as small as possible.

【0024】木材領域内の面積,重心計算 図9は、前述のようにして2値化画像から特定された木
材断面Bのみを含む木材領域Fを示したものであり、木
材断面Bには、その表面の変色等のために2値化によっ
て失なわれた欠落部分M1 ,M2 が含まれている。
Calculation of Area and Center of Gravity in Wood Region FIG. 9 shows a wood region F including only the wood cross section B identified from the binarized image as described above. Includes missing portions M 1 and M 2 lost by binarization due to discoloration of the surface.

【0025】この木材領域Fにおける各画素P(x,
y)には2値化による重み付けとして1又は0の値を持
っており、木材断面Bにおける欠落部分M1 ,M2 を除
いた部分つまり斜線部分の画素P(x,y)に1,それ
以外の画素P(x,y)に0を与えたと仮定する。そし
て、木材断面Bに対する面積,重心の計算に際し、2値
化によって失なわれた欠落部分M1 ,M2 の穴埋めを行
う。
Each pixel P (x,
y) has a value of 1 or 0 as the weighting by binarization, and the pixel P (x, y) in the portion except the missing portions M 1 and M 2 in the wood cross section B, that is, the pixel P (x, y) 1, It is assumed that 0 is given to the pixels P (x, y) other than. Then, when calculating the area and the center of gravity for the wood cross section B, the missing portions M 1 and M 2 lost by binarization are filled.

【0026】いま、木材領域FにおけるあるY座標y1
上の直線(X1',Y1 )−(X2',y1 )において、木
材領域FのX座標における最小値X1'から最大値X2'に
向って走査し、最初にP(x,y)=1となる点P1
座標を(x1 ,y1 )とし、同様に最大値X2'から最小
値X1'に向って走査し、最初にP(x,y)=1となる
点P2 の座標を(x2 ,y1 )とする。そして、このよ
うにして見出された直線(x1 ,y1 )−(x2
1 )におけるすべての画素に対しP(x,y)=1で
あるものとする。
Now, a Y coordinate y 1 in the wood area F
On the upper straight line (X 1 ', Y 1 )-(X 2 ', y 1 ), scanning is performed from the minimum value X 1 'in the X coordinate of the wood region F toward the maximum value X 2 ', and first P ( x, y) = 1, the coordinates of the point P 1 are (x 1 , y 1 ), and similarly, scanning is performed from the maximum value X 2 ′ to the minimum value X 1 ′, and first P (x, y) The coordinates of the point P 2 where = 1 is set to (x 2 , y 1 ). The straight line (x 1 , y 1 ) − (x 2 ,
Let P (x, y) = 1 for all pixels in y 1 ).

【0027】これにより、例えばY座標y2 上の直線
(X1',y2 )−(X2',y2 )のように欠落部分M1
を含む場合、両側からの走査により最初にP(x,y)
=1となる点P3 ,P4 間のすべての画素に対してP
(x,y)=1とするため、欠落点P5 ,P6 間の画素
もP(x,y)=1となり、欠落部分M1 を穴埋めして
補正することが可能となる。
As a result, for example, a missing portion M 1 such as a straight line (X 1 ', y 2 )-(X 2 ', y 2 ) on the Y coordinate y 2
, Then first scan P (x, y) from both sides.
P for all pixels between points P 3 and P 4 where = 1
Since (x, y) = 1, the pixel between the missing points P 5 and P 6 also has P (x, y) = 1, and the missing portion M 1 can be filled in and corrected.

【0028】このようにして木材断面Bにおける欠落部
分M1 ,M2 を穴埋めした上で、木材断面Bの面積Sを
次の数1〜数3の式を用いて計算する。
In this manner, the missing portions M 1 and M 2 in the wood cross section B are filled up, and then the area S of the wood cross section B is calculated using the following equations (1) to (3).

【0029】[0029]

【数1】 [Equation 1]

【0030】[0030]

【数2】 [Equation 2]

【0031】[0031]

【数3】 [Equation 3]

【0032】ここで、数1の式に示すSxは、木材領域
FのすべてのY座標Y1'〜Y2'に対し、X座標の最小値
1'からの走査により最初にP(x,y)=1となった
X座標の値X12から、X座標の最大値X2'からの走査に
より最初にP(x,y)=1となったX座標の値X21
でをすべてP(x,y)=1として計算した面積であ
る。
Here, Sx shown in the equation (1) is first obtained by scanning from the minimum X coordinate value X 1 ′ to P (x) for all Y coordinates Y 1 ′ to Y 2 ′ of the wood area F. , Y) = 1 from the X coordinate value X 12 to the X coordinate value X 21 at which P (x, y) = 1 is first obtained by scanning from the maximum X coordinate value X 2 ′. It is the area calculated as P (x, y) = 1.

【0033】また、数2の式に示すSyは、木材領域F
のすべてのX座標X1'〜X2'に対し、Y座標の最小値Y
1'からの走査により最初にP(x,y)=1となったY
座標の値Y12から、Y座標の最大値Y2'からの走査によ
り最初にP(x,y)=1となったY座標の値Y21まで
をすべてP(x,y)=1として計算した面積である。
そして、数3の式によって両者の面積Sx,Syの平均
を木材断面Bの面積Sとしている。また、木材断面Bの
重心Wは、つぎの数4〜数9の式を用いてそのX座標X
w,y座標Ywを計算する。なお、前述した穴埋めを考
慮し、数4〜数7の式においてP(x,y)=1とす
る。
Further, Sy shown in the equation (2) is the wood region F
The minimum Y coordinate Y for all X coordinates X 1 'to X 2 ' of
Y which first became P (x, y) = 1 by scanning from 1 '
From the coordinate value Y 12 to the Y coordinate value Y 21 at which P (x, y) = 1 was first obtained by scanning from the maximum Y coordinate Y 2 ′, all P (x, y) = 1 are set. This is the calculated area.
Then, the average of the areas Sx and Sy of the both is defined as the area S of the wood cross section B by the equation (3). In addition, the center of gravity W of the wood cross section B is calculated by using the following formulas 4 to 9 for the X coordinate X thereof.
Calculate the w, y coordinates Yw. Note that P (x, y) = 1 in the equations (4) to (7) in consideration of the above-mentioned filling.

【0034】[0034]

【数4】 [Equation 4]

【0035】[0035]

【数5】 [Equation 5]

【0036】[0036]

【数6】 [Equation 6]

【0037】[0037]

【数7】 [Equation 7]

【0038】[0038]

【数8】 [Equation 8]

【0039】[0039]

【数9】 [Equation 9]

【0040】なお、図9において、W0 は欠落部分
1 ,M2 の穴埋めをしない従来方法による重心位置で
ある。ところで、前記では、木材断面B内に2値化によ
って失なわれた欠落部分M1,M2 が存在する場合、す
なわち欠落部分M1 ,M2 が木材断面Bによって囲まれ
ている場合であり、このような場合、本発明の穴埋めの
処理によりこの欠落部分M1 ,M2 を確実に補正するこ
とができる。
In FIG. 9, W 0 is the position of the center of gravity according to the conventional method in which the missing portions M 1 and M 2 are not filled. By the way, in the above, there is a case in which the missing portions M 1 and M 2 lost due to binarization exist in the wood section B, that is, the missing sections M 1 and M 2 are surrounded by the wood section B. In such a case, the missing portions M 1 and M 2 can be reliably corrected by the filling processing of the present invention.

【0041】一方、2値化によって得られた木材断面と
しては、図10に示すように、木材断面Bの周囲が欠落
部分Q,Rによって欠け、Pの部分しか残らない場合が
ある。
On the other hand, as a wood cross section obtained by binarization, as shown in FIG. 10, the periphery of the wood cross section B may be chipped by the missing portions Q and R, and only the P portion may remain.

【0042】このような場合、前記数1の式で求めた面
積Sxには欠落部分Qが含まれず、Sx=P+Rとな
り、また、数2の式で求めた面積Syには欠落部分Rが
含まれず、Sy=P+Qとなるが、数3の式のように、
この両者Sx,Syの平均値を木材断面Bの面積S(=
(Sx+Sy)/2)とするため、面積S’=Pとする
従来方法による計算結果と比較して、失なわれた部分
Q,Rを含めて計算することが可能となり、より正確な
計算結果が得られ、重心Wの計算においても、従来方法
による重心位置W0 に対し良好な結果が得られる。な
お、前記図10の場合、従来方法で求めた面積S’と本
発明による面積Sx,Syとを用いれば、より正確な面
積S(=Sx+Sy−S’)が得られる。
In such a case, the area Sx obtained by the equation 1 does not include the missing portion Q, and Sx = P + R, and the area Sy obtained by the equation 2 includes the missing portion R. Without this, Sy = P + Q, but as in the equation (3),
The average value of both Sx and Sy is the area S (=
Since (Sx + Sy) / 2), it is possible to calculate including the lost parts Q and R, as compared with the calculation result by the conventional method where the area S ′ = P, and a more accurate calculation result Also in the calculation of the center of gravity W, a good result is obtained for the center of gravity position W 0 by the conventional method. In the case of FIG. 10, a more accurate area S (= Sx + Sy−S ′) can be obtained by using the area S ′ obtained by the conventional method and the areas Sx and Sy according to the present invention.

【0043】[0043]

【発明の効果】本発明は、以上説明したように構成され
ているため、つぎに記載する効果を奏する。対象物を撮
映した原画像の2値化に際し、明るさの閾値を2つ設定
することにより可能な限り背景を含まない対象物画像を
得ることができ、対象物の測定の正確さが大幅に増し、
しかも、2値化画像において対象物画像のみを含む最小
の画像領域を特定するため、2値化によっても背景を分
離できない場合であっても、対象物画像のみを取り出し
て背景が面積,重心の計算に与える悪影響を抑えること
ができ、その上、計算時間の短縮化が図れるものであ
る。
Since the present invention is constructed as described above, it has the following effects. When binarizing the original image of the object, by setting two brightness thresholds, it is possible to obtain an object image that does not include the background as much as possible. To
Moreover, since the minimum image area including only the object image in the binarized image is specified, even if the background cannot be separated even by binarization, only the object image is extracted and the background has the area and the center of gravity. It is possible to suppress the adverse effect on the calculation and further shorten the calculation time.

【0044】さらに、対象物の部分的な変色等により2
値化によって対象物画像の一部が失なわれても、現在残
っている部分から計算することで欠落部分の穴埋めを行
うことができ、面積及び重心を正確に算出できるもので
ある。
Furthermore, due to partial discoloration of the object,
Even if a part of the object image is lost due to the binarization, the missing part can be filled in by calculating from the currently remaining part, and the area and the center of gravity can be accurately calculated.

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

【図1】本発明による画像処理方法の実施例を説明する
動作説明用フローチャートである。
FIG. 1 is a flow chart for explaining an operation for explaining an embodiment of an image processing method according to the present invention.

【図2】本発明を適用した画像処理装置のブロック構成
図である。
FIG. 2 is a block configuration diagram of an image processing apparatus to which the present invention has been applied.

【図3】テレビカメラからの原画像を示す図である。FIG. 3 is a diagram showing an original image from a television camera.

【図4】図3のL−L線における明るさの分布図であ
る。
FIG. 4 is a brightness distribution diagram along line LL in FIG. 3;

【図5】2値化画像を示す図であり、(A)は従来例、
(B)は実施例である。
FIG. 5 is a diagram showing a binarized image, in which (A) is a conventional example,
(B) is an example.

【図6】図3の原画像における画素数と明るさとの関係
を示す図である。
6 is a diagram showing a relationship between the number of pixels and brightness in the original image of FIG.

【図7】2値化画像における木材領域の特定のための説
明図である。
FIG. 7 is an explanatory diagram for specifying a wood region in a binarized image.

【図8】図7における木材領域特定のための走査例を示
し、(A)はX座標に対する累積画素数の説明図、
(B)はY座標に対する累積画素数の説明図である。
FIG. 8 shows an example of scanning for identifying a wood region in FIG. 7, (A) is an explanatory diagram of the cumulative number of pixels with respect to the X coordinate,
(B) is an explanatory diagram of the cumulative number of pixels for the Y coordinate.

【図9】特定された木材領域を示す図である。FIG. 9 is a diagram showing a specified wood area.

【図10】木材断面の他の例を示す図である。FIG. 10 is a diagram showing another example of a wood cross section.

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

2 テレビカメラ A,C 背景 B 木材断面 a,b,c,d 閾値 F 木材領域 2 TV cameras A, C Background B Wood cross section a, b, c, d Threshold F Wood area

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 対象物を撮映したテレビカメラからの原
画像を背景と前記対象物とを分離する2つの明るさの閾
値を設定して2値化し、 2値化された画像のX座標に対するY軸方向の累積画素
数及びY座標に対するX軸方向の累積画素数に対しそれ
ぞれ閾値を設定して対象物画像のみを取り出すと共に、
前記対象物画像のみを含む最小の画像領域を特定し、 特定された前記画像領域における各Y座標上の直線及び
各X座標上の直線に対し、前記画像領域の最小値と最大
値とからそれぞれ走査して最初に前記対象物画像に到達
した両座標間を前記対象物の領域とみなして前記2値化
によって失なわれた部分を穴埋めし、 穴埋めによって補正された前記対象物画像から面積及び
重心を算出することを特徴とする画像処理方法。
1. An X-coordinate of a binarized image in which an original image from a television camera that images an object is binarized by setting two thresholds of brightness for separating the background and the object. With respect to the Y-axis direction cumulative pixel number and the Y-axis direction cumulative pixel number with respect to each of the threshold values are set, and only the object image is extracted.
A minimum image area including only the object image is specified, and a straight line on each Y coordinate and a straight line on each X coordinate in the specified image area is respectively selected from the minimum value and the maximum value of the image area. The area between the two coordinates which has reached the object image by scanning is regarded as the area of the object and the portion lost by the binarization is filled in, and the area of the object image corrected by the filling An image processing method characterized by calculating a center of gravity.
JP4105789A 1992-03-30 1992-03-30 Image processing method Pending JPH05282443A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4105789A JPH05282443A (en) 1992-03-30 1992-03-30 Image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4105789A JPH05282443A (en) 1992-03-30 1992-03-30 Image processing method

Publications (1)

Publication Number Publication Date
JPH05282443A true JPH05282443A (en) 1993-10-29

Family

ID=14416906

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4105789A Pending JPH05282443A (en) 1992-03-30 1992-03-30 Image processing method

Country Status (1)

Country Link
JP (1) JPH05282443A (en)

Similar Documents

Publication Publication Date Title
JP4323097B2 (en) Method and system for detecting errors in sample images
JP2007285754A (en) Flaw detection method and flaw detector
US20080063271A1 (en) Character extracting apparatus, method, and program
JP4320990B2 (en) Screen defect detection method and apparatus, and screen defect detection program
JPH05282443A (en) Image processing method
TWI510776B (en) Bubble inspection processing method for glass
JP2006035505A (en) Method and device for inspecting printed matter
JP3941403B2 (en) Image density unevenness detection method and inspection apparatus
JPH05342414A (en) Template preparing device and pattern recognizing device
JP7300155B2 (en) Teaching device in solid preparation appearance inspection, and teaching method in solid preparation appearance inspection
JPH0546763A (en) Image processor
JPH06258243A (en) Mounting part inspection device
JP2966711B2 (en) Image contour extraction method and apparatus
JP2003346165A (en) Detection method of work boundary
JPH0760459B2 (en) Corner detector
JPH11205823A (en) Frame position/form detection method for crt display monitor
JP2959042B2 (en) Image pattern extraction method
JPH0720782Y2 (en) Image processing device
JPH10289311A (en) Check method and device for printed matter
JP2971793B2 (en) Position detection device
JPH11203470A (en) Surface condition setting method and image recognition method
JPS63276371A (en) Method and apparatus for adjusting picture angle of video camera
JP2971794B2 (en) Projection threshold determination device and inspection device
JPH087787B2 (en) Color image area extraction method
JPH01161137A (en) Recognizing device

Legal Events

Date Code Title Description
FPAY Renewal fee payment (prs date is renewal date of database)

Year of fee payment: 14

Free format text: PAYMENT UNTIL: 20090405

EXPY Cancellation because of completion of term