JPH0528268A - Image processing device - Google Patents

Image processing device

Info

Publication number
JPH0528268A
JPH0528268A JP3182306A JP18230691A JPH0528268A JP H0528268 A JPH0528268 A JP H0528268A JP 3182306 A JP3182306 A JP 3182306A JP 18230691 A JP18230691 A JP 18230691A JP H0528268 A JPH0528268 A JP H0528268A
Authority
JP
Japan
Prior art keywords
image
work
quadrangle
pixel
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
JP3182306A
Other languages
Japanese (ja)
Other versions
JP2822700B2 (en
Inventor
Kazuo Funakubo
一夫 舟久保
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP3182306A priority Critical patent/JP2822700B2/en
Publication of JPH0528268A publication Critical patent/JPH0528268A/en
Application granted granted Critical
Publication of JP2822700B2 publication Critical patent/JP2822700B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

(57)【要約】 【目的】 CCDカメラの視野に収まらない大形の四角
形ワークや、高精度を要する四角形ワークの位置及び傾
きの検出ができる画像処理装置とする。 【構成】 第一及び第二の2台のCCDカメラと、四角
形ワークの位置及び傾きを検出する位置・傾き検出手段
とを備え、2台のCCDカメラで四角形ワークの2頂点
の画像を各々取込み、この2頂点の画像データを基にし
て、2値化処理、ランレングスアドレス作成処理、外接
四角形抽出処理、及び頂点算出処理により2頂点の座標
を求め、この2つの頂点座標から前記四角形ワークの位
置及び傾きを検出する。
(57) [Summary] [Object] To provide an image processing apparatus capable of detecting the position and inclination of a large rectangular work that does not fit within the field of view of a CCD camera or a highly accurate rectangular work. [Structure] The first and second two CCD cameras and a position / tilt detecting means for detecting the position and inclination of a square work are provided, and two CCD cameras respectively capture images of two vertices of the square work. Based on the image data of the two vertices, the coordinates of the two vertices are obtained by the binarization process, the run length address creation process, the circumscribed quadrangle extraction process, and the vertex calculation process, and the quadrangle work of the quadrangle work is calculated from these two vertex coordinates. Detect position and tilt.

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 apparatus, and more particularly to an image processing for detecting the position and inclination of a quadrangle work by digitally processing image data of the quadrangle work obtained by an optical method. It relates to the device.

【0002】[0002]

【従来の技術】従来の画像処理装置では、1台のCCD
カメラ等で四角形ワークの全体像を撮像し、得られた画
像データを取込んで画像メモリに保存し、それをソフト
ウェア或いはハードウェアにより2値化処理を施し、2
値化された四角形の各画素から重心座標及びX,Y座標
軸方向の二次モーメントを算出することにより、四角形
ワークの位置や傾きを求めている。
2. Description of the Related Art In a conventional image processing apparatus, one CCD
The whole image of the quadrangle work is taken with a camera, the obtained image data is taken in and stored in the image memory, and it is binarized by software or hardware.
The position and the inclination of the quadrangle work are calculated by calculating the barycentric coordinates and the secondary moments in the X and Y coordinate axis directions from each of the binarized pixels.

【0003】この従来の技術について、図を用いて説明
する。まず、位置検出について述べる。従来の位置検出
は、1台のCCDカメラ等で画像を読込み、2値化処理
後に、画像データから演算を行ない、重心座標を求めて
いる。図9を参照に従来の技術について説明する。図9
は従来の画像処理装置による2値画像を示す説明図であ
る。
This conventional technique will be described with reference to the drawings. First, the position detection will be described. In the conventional position detection, an image is read by one CCD camera or the like, and after binarization processing, calculation is performed from image data to obtain barycentric coordinates. A conventional technique will be described with reference to FIG. Figure 9
FIG. 7 is an explanatory diagram showing a binary image by a conventional image processing device.

【0004】図において、斜線部は存在している画素を
示し、この画素の塊である斜線部全体が画像である。そ
して、この画像から位置検出を行なうには、重心座標を
求めるのが一般的である。この重心を求める方法を図1
0及び図11のフローチャートを用いて説明する。図1
0は従来の画像処理装置による重心のX座標を求める処
理を示すフローチャートであり、図11は従来の画像処
理装置による重心のY座標を求める処理を示すフローチ
ャートである。図9のような座標画面上の画素の塊の全
画素について、図10及び図11のような処理を行なう
ことにより、画素の塊である画像の重心座標が求まる。
In the figure, the shaded area indicates existing pixels, and the entire shaded area, which is a group of the pixels, is an image. Then, in order to detect the position from this image, the barycentric coordinates are generally obtained. Figure 1 shows how to find this center of gravity.
0 and the flowchart of FIG. 11 will be described. Figure 1
0 is a flowchart showing a process of obtaining the X-coordinate of the center of gravity by the conventional image processing apparatus, and FIG. 11 is a flowchart showing a process of obtaining the Y-coordinate of the center of gravity by the conventional image processing apparatus. By performing the processes shown in FIGS. 10 and 11 on all the pixels of the pixel block on the coordinate screen as shown in FIG. 9, the barycentric coordinates of the image as the pixel block can be obtained.

【0005】まず、X座標を算出する方法について述べ
る。図10において、ステップS1001でX方向のラ
イン番号nの初期設定をする。そして、ステップS10
02で該X方向のnラインの開始座標及び終了座標(X
s ,Xe)を求め、ステップS1003で該X方向のn
ラインの画素数(pixel)を求め、ステップS10
04で前記nラインの画素数(pixel)をnライン
よりも前迄の画素数に加算し、総画素数(area)を
求め、ステップS1005でgrvを次の(1)式によ
り演算する。 grv=grv+{pixel*(Xs +Xe )}/2 ・・(1)式 なお、このgrvは画素によるY軸に関する面積モーメ
ント(一次モーメント)として把握できる。
First, a method of calculating the X coordinate will be described. In FIG. 10, in step S1001, the line number n in the X direction is initialized. Then, step S10
At 02, the start and end coordinates (X
s, Xe), and n in the X direction is calculated in step S1003.
The number of pixels of the line (pixel) is calculated, and step S10
In 04, the number of pixels of the n line (pixel) is added to the number of pixels before the n line to obtain the total number of pixels (area). In step S1005, grv is calculated by the following equation (1). grv = grv + {pixel * (Xs + Xe)} / 2 (1) This grv can be understood as an area moment (first moment) about the Y axis by the pixel.

【0006】この後、ステップS1006で最後のライ
ンのgrvの演算が終了したか否かを判断し、未だ最後
のラインのgrvの演算が終了していない場合は、ステ
ップS1007でX方向のラインのライン番号nをイン
クリメントして、ステップS1002に戻り、次の未処
理のラインについて上記の処理を繰返す。そして、最後
のラインのgrvの演算が終了した後に、ステップS1
008に進み、重心のX座標を次の(2)式により求め
る。 gravX=grv/area ・・・(2)式
Thereafter, in step S1006, it is determined whether or not the calculation of the grv of the last line is completed. If the calculation of the grv of the last line is not completed yet, the calculation of the line in the X direction is completed in step S1007. The line number n is incremented, the process returns to step S1002, and the above process is repeated for the next unprocessed line. Then, after the calculation of the grv of the last line is completed, step S1
Proceeding to 008, the X coordinate of the center of gravity is obtained by the following equation (2). gravX = grv / area (2) Expression

【0007】ここで、図9の2値画像の重心のX座標を
上記方法により算出する。まず、1ライン目の処理で
は、画素が無く、画素数も0であるので、grvも0で
ある。 2ライン目の処理では、Xs =1,Xe =2、pixe
l=2、area=2であるから、grv=0+{2*
(1+2)}/2=3となる。 3ライン目の処理では、Xs =1,Xe =2、pixe
l=2、area=4であるから、grv=3+{2*
(1+2)}/2=6となる。 4ライン目の処理では、Xs =1,Xe =4、pixe
l=4、area=8であるから、grv=6+{4*
(1+4)}/2=16となる。 5ライン目の処理では、Xs =1,Xe =4、pixe
l=4、area=12であるから、grv=16+
{4*(1+4)}/2=26となる。 これで、全てのラインについての処理が終わり、この結
果を利用して重心のX座標gravXを求める処理を行
なう。即ち、gravX=26/12=2.166…と
なり、図9の2値画像の重心のX座標gravX2.
2となる。
Here, the X coordinate of the center of gravity of the binary image of FIG. 9 is calculated by the above method. First, in the processing of the first line, since there are no pixels and the number of pixels is 0, grv is also 0. In the processing of the second line, Xs = 1, Xe = 2, pixel
Since l = 2 and area = 2, grv = 0 + {2 *
(1 + 2)} / 2 = 3. In the processing of the third line, Xs = 1, Xe = 2, pixel
Since l = 2 and area = 4, grv = 3 + {2 *
(1 + 2)} / 2 = 6. In the processing of the fourth line, Xs = 1, Xe = 4, pixel
Since l = 4 and area = 8, grv = 6 + {4 *
(1 + 4)} / 2 = 16. In the processing of the fifth line, Xs = 1, Xe = 4, pixel
Since l = 4 and area = 12, grv = 16 +
{4 * (1 + 4)} / 2 = 26. This completes the processing for all the lines, and the processing for obtaining the X coordinate gravX of the center of gravity is performed using this result. That is, gravX = 26/12 = 2.166 ..., and the X coordinate of the center of gravity of the binary image in FIG.
It becomes 2.

【0008】次に、Y座標を算出する方法について述べ
る。図11において、ステップS1101でX方向のラ
イン番号nの初期設定をする。そして、ステップS11
02で該X方向のnラインの開始座標、終了座標(Xs
,Xe )及びY座標(Y)を求め、ステップS110
3で該X方向のnラインの画素数(pixel)を求
め、ステップS1104で前記nラインの画素数(pi
xel)をnラインよりも前迄の画素数に加算し、総画
素数(area)を求め、ステップS1105でgrv
を次の(3)式により演算する。 grv=grv+(pixel*Y) ・・・(3)式 なお、このgrvは画素によるX軸に関する面積モーメ
ント(一次モーメント)として把握できる。
Next, a method of calculating the Y coordinate will be described. In FIG. 11, in step S1101, the line number n in the X direction is initialized. Then, step S11
02, the start and end coordinates (Xs
, Xe) and the Y coordinate (Y) are obtained, and step S110
3, the number of pixels of the n lines in the X direction (pixel) is obtained, and in step S1104, the number of pixels of the n lines (pi).
xel) is added to the number of pixels before the nth line to obtain the total number of pixels (area), and grv is calculated in step S1105.
Is calculated by the following equation (3). grv = grv + (pixel * Y) Equation (3) This grv can be grasped as an area moment (first moment) about the X axis by the pixel.

【0009】この後、ステップS1106で最後のライ
ンのgrvの演算が終了したか否かを判断し、未だ最後
のラインのgrvの演算が終了していない場合は、ステ
ップS1107でX方向のラインのライン番号nをイン
クリメントして、ステップS1102に戻り、次の未処
理のラインについて上記の処理を繰返す。そして、最後
のラインのgrvの演算が終了した後に、ステップS1
108に進み、重心のY座標を次の(4)式により求め
る。 gravY=grv/area ・・・(4)式
Thereafter, in step S1106, it is judged whether or not the calculation of the grv of the last line is completed. If the calculation of the grv of the last line is not completed yet, the calculation of the line in the X direction is completed in step S1107. The line number n is incremented, the process returns to step S1102, and the above process is repeated for the next unprocessed line. Then, after the calculation of the grv of the last line is completed, step S1
Proceeding to 108, the Y coordinate of the center of gravity is obtained by the following equation (4). gravY = grv / area (4) Expression

【0010】ここで、図9の2値画像の重心のY座標を
上記方法により算出する。まず、1ライン目の処理で
は、画素が無く、画素数も0であるので、grvも0で
ある。 2ライン目の処理では、Xs =1,Xe =2、Y=1、
pixel=2、area=2であるから、grv=0
+2*1=2となる。 3ライン目の処理では、Xs =1,Xe =2、Y=2、
pixel=2、area=4であるから、grv=2
+2*2=6となる。 4ライン目の処理では、Xs =1,Xe =4、Y=3、
pixel=4、area=8であるから、grv=6
+4*3=18となる。 5ライン目の処理では、Xs =1,Xe =4、Y=4、
pixel=4、area=12であるから、grv=
18+4*4=34となる。
Here, the Y coordinate of the center of gravity of the binary image of FIG. 9 is calculated by the above method. First, in the processing of the first line, since there are no pixels and the number of pixels is 0, grv is also 0. In the processing of the second line, Xs = 1, Xe = 2, Y = 1,
Since pixel = 2 and area = 2, grv = 0
+ 2 * 1 = 2. In the processing of the third line, Xs = 1, Xe = 2, Y = 2,
Since pixel = 2 and area = 4, grv = 2
It becomes + 2 * 2 = 6. In the processing of the fourth line, Xs = 1, Xe = 4, Y = 3,
Since pixel = 4 and area = 8, grv = 6
It becomes + 4 * 3 = 18. In the processing of the fifth line, Xs = 1, Xe = 4, Y = 4,
Since pixel = 4 and area = 12, grv =
18 + 4 * 4 = 34.

【0011】これで、全てのラインについての処理が終
わり、この結果を利用して重心のY座標gravYを求
める処理を行なう。即ち、gravY=34/12=
2.833…となり、図9の2値画像の重心のY座標g
ravY2.8となる。したがって、図9の2値画像
の重心座標(gravX,gravY)は(2.2,
2.8)となる。
With this, the processing for all the lines is completed, and the result is used to perform the processing for obtaining the Y coordinate gravY of the center of gravity. That is, gravY = 34/12 =
2.833 ... and the Y coordinate g of the center of gravity of the binary image in FIG.
It becomes rvY2.8. Therefore, the barycentric coordinates (gravX, gravY) of the binary image in FIG. 9 are (2.2,
2.8).

【0012】続いて、傾きを算出する方法について述べ
る。図12は従来の画像処理装置による傾きを求める処
理を示すフローチャートである。
Next, a method of calculating the inclination will be described. FIG. 12 is a flowchart showing a process of obtaining a tilt by the conventional image processing apparatus.

【0013】図12において、ステップS1201でX
方向のライン番号nの初期設定をする。そして、ステッ
プS1202で該X方向のnラインの画素の断面相乗モ
ーメント(KnXY )を求め、ステップS1203で該X
方向のnラインの画素のX軸に対する断面二次モーメン
ト(InX)を求め、ステップS1204で該X方向のn
ラインの画素のY軸に対する断面二次モーメント(In
Y)を求める。この後、ステップS1205で最後のラ
インについて演算が終了したか否かを判断し、未だ最後
のラインの演算が終了していない場合は、ステップS1
206でX方向のラインのライン番号nをインクリメン
トして、ステップS1202に戻り、次の未処理のライ
ンについて上記の処理を繰返す。そして、最後のライン
の演算が終了した後に、ステップS1207に進み、重
心座標(gravX,gravY)を算出する。なお、
この重心座標の算出は、上記の図10及び図11の処理
によって求まる。ステップS1208では、全画素数を
加算して総画素面積(area)を求め、ステップS1
209では全画素の断面相乗モーメント(KXY)を、ス
テップS1210で全画素のX軸に対する断面二次モー
メント(IX )を、ステップS1211で全画素のY軸
に対する断面二次モーメント(IY )を各々求め、ステ
ップS1212で傾き(θ)を算出する。この傾き
(θ)は次の既知の(5)式により演算する。 θ=(1/2)tan-1{2KXY/(IY −IX )} ・・・(5)式 なお、(5)式において、KXYは全画素の断面相乗モー
メント、IX は全画素のX軸に対する断面二次モーメン
ト、IY は全画素のY軸に対する断面二次モーメントで
ある。
In FIG. 12, X is determined in step S1201.
Initialize the line number n in the direction. Then, in step S1202, the cross-sectional synergistic moment (KnXY) of the pixel of the n line in the X direction is obtained, and in step S1203, the X
The second moment of area (InX) with respect to the X-axis of the pixel of the n-line in the X direction is obtained, and in Step S1204, the n in the X direction is calculated.
The second moment of area (In
Y) is asked. After this, in step S1205, it is determined whether or not the calculation for the last line has been completed. If the calculation for the last line has not yet been completed, step S1
In 206, the line number n of the line in the X direction is incremented, the process returns to step S1202, and the above process is repeated for the next unprocessed line. Then, after the calculation of the last line is completed, the process advances to step S1207 to calculate the barycentric coordinates (gravX, gravY). In addition,
The calculation of the barycentric coordinates can be obtained by the processing of FIGS. 10 and 11. In step S1208, the total number of pixels is added to obtain a total pixel area (area).
In step S209, the geometrical moment of inertia (KXY) of all pixels is calculated, in step S1210 the moment of inertia of area (IX) of all pixels with respect to the X-axis, and in step S1211, the moment of inertia of area (IY) of all pixels with respect to the Y-axis is calculated. The inclination (θ) is calculated in step S1212. This inclination (θ) is calculated by the following known equation (5). θ = (1/2) tan -1 {2KXY / (IY-IX)} Equation (5) In Equation (5), KXY is the cross-sectional synergistic moment of all pixels and IX is the X-axis of all pixels. Is the moment of inertia of area, IY is the moment of inertia of area for the Y axis of all pixels.

【0014】ここで、図9の2値画像の各ラインについ
て上記方法によりKnXY 、InX、InYを求め、これを利
用して傾きθを算出する。まず、1ライン目の処理で
は、画素が無く、K1XY 、I1X、I1Yは共に0である。 2ライン目の処理では、K2XY =1×1+1×2=3、
I2X=12 +12 =2、I2Y=12 +22 =5となる。 3ライン目の処理では、K3XY =2×1+2×2=6、
I3X=22 +22 =8、I3Y=12 +22 =5となる。 4ライン目の処理では、K4XY =3×1+3×2+3×
3+3×4=30、I4X=32 +32 +32 +32 =3
6、I4Y=12 +22 +32 +42 =30となる。 5ライン目の処理では、K5XY =4×1+4×2+4×
3+4×4=40、I5X=42 +42 +42 +42 =6
4、I5Y=12 +22 +32 +42 =30となる。
Here, KnXY, InX, and InY are obtained for each line of the binary image of FIG. 9 by the above method, and the inclination θ is calculated using this. First, in the processing of the first line, there are no pixels, and K1XY, I1X, and I1Y are all 0. In the processing of the second line, K2XY = 1 × 1 + 1 × 2 = 3,
I2X = 1 2 +1 2 = 2 and I2Y = 1 2 +2 2 = 5. In the processing of the third line, K3XY = 2x1 + 2x2 = 6,
I3X = 2 2 +2 2 = 8 and I3Y = 1 2 +2 2 = 5. In the processing of the 4th line, K4XY = 3 x 1 + 3 x 2 + 3 x
3 + 3 × 4 = 30, I4X = 3 2 +3 2 +3 2 +3 2 = 3
6, I4Y = 1 2 +2 2 +3 2 +4 2 = 30. In the processing of the 5th line, K5XY = 4 x 1 + 4 x 2 + 4 x
3 + 4 × 4 = 40, I5X = 4 2 +4 2 +4 2 +4 2 = 6
4, I5Y = 1 2 +2 2 +3 2 +4 2 = 30.

【0015】また、面積(area)=12、 重心座標(gravX,gravY)=(2.2,2.
8) であるから、全画素の断面相乗モーメント(KXY)、X
軸に対する断面二次モーメント(IX )、Y軸に対する
断面二次モーメント(IY )は次のようになる。 KXY=(K2XY +K3XY +K4XY +K5XY )−(area×gravX ×gravY) =(3+6+30+40)−(12×2.2×2.8)=5.08 IX =(I2X+I3X+I4X+I5X)−(area×gravX×gravX) =(2+8+36+64)−(12×2.2×2.2)=51.92 IY =(I2Y+I3Y+I4Y+I5Y)−(area×gravY×gravY) =(5+5+30+30)−(12×2.8×2.8)=−24.08
Area (area) = 12, barycentric coordinates (gravX, gravY) = (2.2, 2.
8) Therefore, the cross-sectional synergistic moment (KXY) of all pixels (KXY), X
The geometrical moment of inertia (IX) with respect to the axis and the geometrical moment of inertia (IY) with respect to the Y axis are as follows. KXY = (K2XY + K3XY + K4XY + K5XY)-(area x gravX x gravY) = (3 + 6 + 30 + 40)-(12 x 2.2 x 2.8) = 5.08 IX = (I2X + I3X + I4X + I5X)-(xrea x gra xra) (2 + 8 + 36 + 64)-(12 * 2.2 * 2.2) = 51.92 IY = (I2Y + I3Y + I4Y + I5Y)-(area * gravY * gravY) = (5 + 5 + 30 + 30)-(12 * 2.8 * 2.8) =- 24.08

【0016】したがって、傾き(θ)は、 θ=(1/2)tan-1{(2×5.08)/(−24.08−51.92)} −3.81(度)となる。こうして、図9の2値画像
の傾き(θ)が求まる。
Therefore, the inclination (θ) is θ = (1/2) tan −1 {(2 × 5.08) / (− 24.08−51.92)} −3.81 (degrees). .. In this way, the inclination (θ) of the binary image in FIG. 9 is obtained.

【0017】なお、この他の従来の画像処理装置とし
て、特開平2−250181号公報に掲載の技術を挙げ
ることができる。これは、2値化処理によって得られた
四角形画像の各頂点の内角を求め、これらの角度のうち
直角に近い角度を有する2つの頂点の四角形における位
置関係から、所望の計算手順を選択して回転ズレ角度を
求めるものである。
As another conventional image processing apparatus, the technique disclosed in Japanese Patent Laid-Open No. 2-250181 can be mentioned. This is to find the interior angle of each vertex of the quadrangle image obtained by the binarization process, and select a desired calculation procedure from the positional relationship in the quadrangle of two vertices having angles close to right angles among these angles. This is to obtain the rotational deviation angle.

【0018】[0018]

【発明が解決しようとする課題】上記のような従来の画
像処理装置では、1台のCCDカメラ等で四角形ワーク
の全体像を撮像し、得られた画像データを利用して図1
0から図12の処理手順を踏んで四角形ワークの位置及
び傾きを求めていた。したがって、CCDカメラの視野
に収まらない大形の四角形ワークの位置及び傾きの検出
はできなかった。
In the conventional image processing apparatus as described above, one CCD camera or the like captures an entire image of a quadrangular work, and the obtained image data is used to obtain the image shown in FIG.
The position and the inclination of the quadrangle work have been obtained by following the processing procedure from 0 to FIG. Therefore, it was not possible to detect the position and inclination of a large quadrangle work that does not fit within the field of view of the CCD camera.

【0019】また、CCDカメラの視野に四角形ワーク
は収まるが、画像の分解能との関係で出力結果を精度良
く求めることができないことがあった。例えば、画像の
分解能は、256×256画素、512×512画素が
一般的であり、視野が固定されていれば、1画素が何ミ
リに相当するかが求まり、この単位画素当りのミリ数は
画像の分解能で決定されるため、これ以上の出力結果の
精度を望むことはできなかった。
Further, although the quadrangle work fits in the field of view of the CCD camera, the output result may not be obtained accurately due to the resolution of the image. For example, the resolution of an image is generally 256 × 256 pixels, 512 × 512 pixels, and if the field of view is fixed, it is possible to find how many millimeters each pixel corresponds to, and the number of millimeters per unit pixel is Since it is determined by the resolution of the image, it was not possible to expect a higher precision of the output result.

【0020】そこで、この発明は、CCDカメラの視野
に収まらない大形の四角形ワークや、高精度を要する四
角形ワークの位置及び傾きの検出ができる画像処理装置
の提供を課題とするものである。
Therefore, an object of the present invention is to provide an image processing apparatus capable of detecting the position and inclination of a large quadrangle work which does not fit in the field of view of a CCD camera or a quadrangle work which requires high accuracy.

【0021】[0021]

【課題を解決するための手段】本発明にかかる画像処理
装置は、四角形ワークの2頂点の画像を各々取込む画像
入力手段と、前記画像入力手段で取込んだ2頂点の画像
データを処理して前記四角形ワークの位置及び傾きを検
出する位置・傾き検出手段とを具備するものである。
An image processing apparatus according to the present invention processes image input means for capturing images of two vertices of a quadrangle work, and image data of two vertices captured by the image input means. And a position / inclination detecting means for detecting the position and inclination of the quadrangular work.

【0022】[0022]

【作用】本発明の画像処理装置においては、画像入力手
段で四角形ワークの2頂点の画像を各々取込み、この2
頂点の位置座標を検出し、この位置座標から四角形ワー
クの位置及び傾きの検出を行なうものであるから、画像
入力手段の視野に収まらない大型の四角形ワークの位置
及び傾きを検出できるとともに、画像の分解能の影響を
受けることなく精度良く四角形ワークの位置及び傾きの
検出ができる。
In the image processing apparatus of the present invention, the image input means captures the images of the two vertices of the quadrangle work, respectively.
Since the position coordinates of the vertices are detected and the position and tilt of the quadrangle work are detected from the position coordinates, the position and tilt of a large quadrangle work that does not fit in the visual field of the image input means can be detected, and the image of the image can be detected. It is possible to detect the position and inclination of a quadrangular work with high accuracy without being affected by the resolution.

【0023】[0023]

【実施例】以下、本発明の実施例について説明をする。EXAMPLES Examples of the present invention will be described below.

【0024】図1は本発明の一実施例である画像処理装
置の処理部及び動作の流を示すフローチャートである。
FIG. 1 is a flow chart showing a flow of processing units and operations of an image processing apparatus according to an embodiment of the present invention.

【0025】図において、ステップS101は画像入力
処理を行なう第1の画像入力部であり、CCDカメラ等
の撮像手段により四角形ワークの頂点を撮像し、その映
像信号を得て、更に、この映像信号をA/D変換して出
力する。ステップS102は2値化処理を行なう2値化
部であり、上記のステップS101でディジタル化され
たデータを2値化処理して、四角形ワークの2値画像を
得る。また、ステップS103のランレングスアドレス
データ作成部では、2値化された四角形ワークの画素の
塊をランレングスアドレスデータとしてとらえ、その開
始、終了アドレスを算出する。ステップS104の外接
四角形抽出部では、ランレングスアドレスデータに基づ
き2値画像の外接四角形の左上と右下の座標を得る。ス
テップS105は四角形ワークの頂点の座標を算出する
頂点算出部であり、前記のステップS104の外接四角
形抽出部で得られた外接四角形の2つの座標から四角形
ワークの頂点の座標を算出する。そして、ステップS1
06では、頂点を算出したのが1台目のCCDカメラ等
の撮像手段であるか、或いは2台目のCCDカメラ等の
撮像手段であるのかを判断し、1台目のCCDカメラ等
の撮像手段により頂点を算出した場合は、ステップS1
07に進み、1台目のCCDカメラ等の撮像手段で算出
した頂点の座標(X1 ,Y1 )をメモリに保存し、ステ
ップS108に進む。ステップS108はステップS1
01と同様の画像入力処理を行なう第2の画像入力部で
あり、2台目のCCDカメラ等の撮像手段により四角形
ワークの2つ目の頂点を撮像し、その映像信号を得て、
更に、この映像信号をA/D変換して出力する。この
後、再びステップS102に戻り、上記の1台目のCC
Dカメラ等の撮像手段と同様の処理手順を行なう。一
方、ステップS106で2台目のCCDカメラ等の撮像
手段により頂点を算出した場合は、ステップS109で
2台目のCCDカメラ等の撮像手段で算出した頂点の座
標(X2 ,Y2 )をメモリに保存する。ステップS11
0では、1台目と2台目の各々のCCDカメラ等の撮像
手段から算出された頂点の座標(X1 ,Y1 ),(X2
,Y2 )から、その中央の座標及び傾き角度を求め
る。但し、外接四角形は2頂点の座標、即ちP1(Xmi
n ,Ymin ),P2(Xmax ,Ymax )を出力するもの
とする。
In the figure, a step S101 is a first image input section for performing an image input process, in which an image of the apex of a quadrangle work is picked up by an image pickup means such as a CCD camera to obtain its image signal, and this image signal is further obtained. Is A / D converted and output. Step S102 is a binarization unit that performs binarization processing, and the data digitized in step S101 is binarized to obtain a binary image of a rectangular work. In addition, the run length address data creation unit in step S103 regards the binarized pixel block of the rectangular work as the run length address data, and calculates the start and end addresses thereof. The circumscribed quadrangle extraction unit in step S104 obtains the upper left and lower right coordinates of the circumscribed quadrangle of the binary image based on the run length address data. Step S105 is a vertex calculation unit that calculates the coordinates of the vertices of the quadrangle work, and calculates the coordinates of the vertices of the quadrangle work from the two coordinates of the circumscribed quadrangle obtained by the circumscribed quadrangle extraction unit of step S104. And step S1
In 06, it is determined whether the apex is calculated by the image pickup means such as the first CCD camera or the like, or by the image pickup means such as the second CCD camera or the like, and the image pickup by the first CCD camera or the like is performed. If the vertices are calculated by the means, step S1
In step 07, the coordinates (X1, Y1) of the apex calculated by the image pickup means such as the first CCD camera are stored in the memory, and the process proceeds to step S108. Step S108 is Step S1
A second image input unit that performs the same image input processing as that of 01. The second apex of the quadrangle work is imaged by an image pickup means such as a second CCD camera, and its video signal is obtained.
Further, this video signal is A / D converted and output. After this, the process returns to step S102 again, and the first CC
A processing procedure similar to that of the image pickup means such as a D camera is performed. On the other hand, when the vertices are calculated by the image pickup means such as the second CCD camera in step S106, the coordinates (X2, Y2) of the vertices calculated by the image pickup means such as the second CCD camera in step S109 are stored in the memory. save. Step S11
At 0, the coordinates (X1, Y1), (X2 of the vertices calculated from the image pickup means such as the CCD cameras of the first and second units, respectively.
, Y2), the coordinates of the center and the tilt angle are obtained. However, the circumscribed rectangle is the coordinates of the two vertices, that is, P1 (Xmi
n, Ymin) and P2 (Xmax, Ymax) are output.

【0026】本実施例を構成する上記の図1中の各要素
のうち、ステップS101の第1の画像入力部、ステッ
プS102の2値化部、ステップS103のランレング
スアドレスデータ作成部、ステップS104の外接四角
形抽出部、及びステップS108の第2の画像入力部に
ついては、既にその詳細は提案されており、公知であっ
たり、或いはディジタル処理から容易に類推できるの
で、これらの説明は省略する。ここでは、本実施例の最
大の特徴部である頂点算出部(ステップS105)、2
つの頂点座標から四角形ワークの位置及び傾きを検出す
る処理(ステップS110)について具体的に説明す
る。
Of the respective elements in FIG. 1 constituting the present embodiment, the first image input section in step S101, the binarization section in step S102, the run length address data creation section in step S103, and step S104. The details of the circumscribed quadrangle extraction unit and the second image input unit of step S108 have already been proposed and are publicly known or can be easily inferred from digital processing, and thus description thereof will be omitted. Here, the vertex calculating unit (step S105), which is the largest feature of this embodiment,
The process (step S110) of detecting the position and inclination of the quadrangle work from the coordinates of one vertex will be specifically described.

【0027】まず、図2で四角形ワークの画像入力の概
要について説明する。図2は本発明の一実施例である画
像処理装置による四角ワークの画像入力の概要を示す説
明図である。
First, an outline of image input of a rectangular work will be described with reference to FIG. FIG. 2 is an explanatory diagram showing an outline of image input of a square work by the image processing apparatus according to the embodiment of the present invention.

【0028】図において、1は四角形ワーク、2は第一
のCCDカメラの視野、3は第二のCCDカメラの視野
であり、4は第一のCCDカメラによる四角形ワーク1
の1つの頂点に外接する外接四角形、5は同じく第二の
CCDカメラによる四角形ワーク1の他の頂点に外接す
る外接四角形である。図2のように、若干傾いた四角形
ワーク1の2頂点が各々第一及び第二のCCDカメラの
視野2,3に入るように設定し、この2台のCCDカメ
ラから画像を入力し、2値化処理を施す。
In the figure, 1 is a square work, 2 is a field of view of a first CCD camera, 3 is a field of view of a second CCD camera, and 4 is a square work 1 by a first CCD camera.
Is a circumscribing quadrangle circumscribing one of the vertices of the same, and 5 is a circumscribing quadrangle circumscribing the other apex of the quadrangle work 1 by the second CCD camera. As shown in FIG. 2, the two vertices of the slightly inclined quadrangle work 1 are set so as to be in the fields of view 2 and 3 of the first and second CCD cameras, respectively. Perform value conversion processing.

【0029】図3は本発明の一実施例である画像処理装
置のCCDカメラによる画像入力後に2値化処理をし、
外接四角形を求めた状態を示す説明図である。この図で
は、求める頂点は、(0,5)或いは(0,6)に相当
すると仮定できる。
FIG. 3 shows a binarization process after image input by a CCD camera of an image processing apparatus according to an embodiment of the present invention.
It is explanatory drawing which shows the state which calculated | required the circumscribed quadrangle. In this figure, it can be assumed that the desired vertex corresponds to (0,5) or (0,6).

【0030】次に、上記の頂点の検出方法について図4
から図8を用いて説明する。図4は本発明の一実施例で
ある画像処理装置による四角ワークの画像入力状態を示
す説明図である。
Next, referring to FIG.
Starting from FIG. FIG. 4 is an explanatory diagram showing an image input state of a square work by the image processing apparatus according to the embodiment of the present invention.

【0031】図において、状態(a)は図2の第一のC
CDカメラの視野2の画像を示し、斜線部が四角形ワー
ク1の2値画像を示す。この状態(a)の画像は、四角
形ワーク1が時計回りに傾斜していることを示してい
る。また、点線は2値画像の外接四角形を表す。そし
て、点1が四角形ワーク1の求めたい頂点に相当する。
このとき、注目するのは、コーナー1とコーナー2に存
在する画素である。状態(a)のコーナー1、即ち、図
3の座標値(0,0)を頂点とする周囲3画素(0,
1),(1,0),(1,1)のいずれにも画素は存在
していない。また、コーナー2、即ち、図3の座標値
(8,8)を頂点とする周囲3画素(8,7),(7,
8),(7,7)のいずれかに画素は存在している(図
3では、全てに画素が存在している)。このような条件
が成立しているときを状態(a)と定義する。
In the figure, the state (a) is the first C in FIG.
The image of the visual field 2 of the CD camera is shown, and the shaded area shows the binary image of the quadrangle work 1. The image in this state (a) shows that the square work 1 is tilted clockwise. The dotted line represents the circumscribed quadrangle of the binary image. The point 1 corresponds to the desired vertex of the square work 1.
At this time, attention is paid to the pixels existing in the corner 1 and the corner 2. Corner 1 of state (a), that is, the surrounding three pixels (0, 0) having the coordinate value (0, 0) in FIG.
No pixel exists in any of 1), (1, 0), and (1, 1). In addition, the corner 2, that is, the surrounding 3 pixels (8, 7), (7, 7) having the coordinate value (8, 8) in FIG.
Pixels are present in any of 8) and (7, 7) (in FIG. 3, pixels are present in all). The condition (a) is defined when such a condition is satisfied.

【0032】また、状態(b)も状態(a)と同様に、
図2の第一のCCDカメラの視野2の画像を示し、この
状態(b)の画像は、四角形ワーク1が反時計回りに傾
斜していることを示している。コーナー1とコーナー2
に存在する画素に注目すると、コーナー1の4画素中の
いずれかには画素が存在し、コーナー2の4画素中のい
ずれにも画素は存在していない。このような条件が成立
しているときを状態(b)と定義する。
The state (b) is the same as the state (a),
The image of the field of view 2 of the first CCD camera of FIG. 2 is shown, and the image in this state (b) shows that the square work 1 is tilted counterclockwise. Corner 1 and corner 2
Attention is paid to the pixels existing in 1), there is a pixel in any of the 4 pixels in the corner 1, and there is no pixel in any of the 4 pixels in the corner 2. The condition (b) is defined when such a condition is satisfied.

【0033】また、状態(c)も状態(a)及び状態
(b)と同様に、図2の第一のCCDカメラの視野2の
画像を示す。コーナー1とコーナー2に存在する画素に
注目すると、コーナー1及びコーナー2の4画素中のい
ずれかに画素が存在している。このような条件が成立し
ているときを状態(c)と定義する。
Similarly to the states (a) and (b), the state (c) also shows an image of the visual field 2 of the first CCD camera shown in FIG. Focusing on the pixels existing in the corner 1 and the corner 2, the pixel exists in any of the four pixels of the corner 1 and the corner 2. The condition (c) is defined when such a condition is satisfied.

【0034】上記のように、CCDカメラの視野の画像
のパターンは大きく三種類の状態に分かれ、各々の状態
に対応した処理が行なわれる。この三種類の状態に分け
る処理の流れが図5である。図5は本発明の一実施例で
ある画像処理装置による画像入力を三種類の状態に振分
ける動作を示すフローチャートである。なお、この図で
は、既に、画像入力後、2値化処理、ランレングスアド
レスデータ作成処理、外接四角形抽出処理は完了してお
り、この図5の処理を行なうプログラムは画像処理のメ
インプログラム実行中にコールされる。
As described above, the image pattern of the field of view of the CCD camera is roughly divided into three states, and the processing corresponding to each state is performed. FIG. 5 shows the flow of processing divided into these three types of states. FIG. 5 is a flow chart showing the operation of distributing the image input to three kinds of states by the image processing apparatus according to the embodiment of the present invention. In this figure, the binarization process, the run length address data creation process, and the circumscribed quadrangle extraction process have already been completed after the image is input, and the program for executing the process of FIG. 5 is executing the main program of the image processing. Be called by.

【0035】図において、まず、ステップS501でコ
ーナー1に画素が存在しているか否かの判断を行ない、
コーナー1に画素が存在する場合は、ステップS502
でコーナー2に画素が存在するか否かの判断を行なう。
コーナー2に画素が存在する場合は、コーナー1及びコ
ーナー2のいずれにも画素が存在するので、ステップS
503に進み、状態(c)の処理を行なう。また、ステ
ップS502でコーナー2に画素が存在しない場合は、
ステップS504で状態(b)の処理を行う。一方、ス
テップS501でコーナー1に画素が存在しない場合
は、ステップS505でコーナー2に画素が存在するか
否かの判断を行なう。コーナー2に画素が存在する場合
は、ステップS506で状態(a)の処理を行ない、ス
テップS505でコーナー2に画素が存在しない場合
は、コーナー1及びコーナー2のいずれにも画素が存在
しないので、ステップS507に進み、エラー処理を行
なう。こうして、外接四角形のコーナー1及びコーナー
2の画素の状態を判断し、その状態に応じて状態(a)
から状態(c)の三種類の状態に振分け、この三種類の
各状態に応じた頂点算出処理動作を行なう。
In the figure, first, in step S501, it is determined whether or not a pixel exists in the corner 1.
If the pixel exists in the corner 1, step S502
Then, it is determined whether or not a pixel exists in the corner 2.
If the pixel exists in the corner 2, the pixel exists in both the corner 1 and the corner 2, so that the step S
Proceeding to 503, the processing of state (c) is performed. If there is no pixel in the corner 2 in step S502,
The state (b) is processed in step S504. On the other hand, if the pixel does not exist in the corner 1 in step S501, it is determined in step S505 whether or not the pixel exists in the corner 2. If the pixel exists in the corner 2, the state (a) is processed in step S506. If the pixel does not exist in the corner 2 in step S505, there is no pixel in the corner 1 and the corner 2. In step S507, error processing is performed. In this way, the states of the pixels at the corner 1 and the corner 2 of the circumscribed quadrangle are determined, and the state (a) is determined according to the state.
To the state (c), and the vertex calculation processing operation is performed according to each of the three types of states.

【0036】ここで、上記の三種類の各状態に応じた頂
点算出処理動作について述べる。図6から図8は図4及
び図5の状態(a)から状態(c)の各状態処理に対応
したフローチャートであり、図6は図4及び図5の状態
(a)の頂点算出処理動作を示し、図7は図4及び図5
の状態(b)の頂点算出処理動作を示し、図8は図4及
び図5の状態(c)の頂点算出処理動作を示す。
Here, the vertex calculation processing operation corresponding to each of the above-mentioned three types of states will be described. FIGS. 6 to 8 are flowcharts corresponding to the respective state processes of the states (a) to (c) of FIGS. 4 and 5, and FIG. 6 is the vertex calculation processing operation of the states (a) of FIGS. 4 and 5. FIG. 7 shows FIG. 4 and FIG.
8 shows the vertex calculation processing operation in the state (b), and FIG. 8 shows the vertex calculation processing operation in the state (c) of FIGS. 4 and 5.

【0037】まず、図6において、ステップS601で
外接四角形のXminを固定し、Y軸の1ライン上をY方
向にサーチをし、各画素の有無を調べ、ステップS60
2で存在する画素のY方向のアドレスを保存する。そし
て、ステップS603でY方向の画素が1画素のみか否
かを判断し、1画素のみの場合は、ステップS604で
該画素のアドレスを、即ち、(Xmin ,Y)を頂点の座
標とする。また、Y方向に複数の画素が存在している場
合には、ステップS605で最大Ymax と最小Ymin の
アドレス値の平均値を求め、ステップS606で該平均
値を採用し、(Xmin ,(Ymax +Ymin )/2)を頂
点の座標とする。こうして、図4の状態(a)における
四角形ワーク1の頂点が求まる。
First, in FIG. 6, in step S601, Xmin of the circumscribing quadrangle is fixed, one line on the Y axis is searched in the Y direction to check the presence or absence of each pixel, and step S60 is performed.
The address of the pixel existing in 2 in the Y direction is stored. Then, in step S603, it is determined whether or not there is only one pixel in the Y direction. If there is only one pixel, then in step S604, the address of the pixel, that is, (Xmin, Y) is set as the vertex coordinate. If there are a plurality of pixels in the Y direction, the average value of the maximum Ymax and minimum Ymin address values is calculated in step S605, and the average value is adopted in step S606 to obtain (Xmin, (Ymax + Ymin ) / 2) is the vertex coordinate. In this way, the vertex of the square work 1 in the state (a) of FIG. 4 is obtained.

【0038】また、図7において、ステップS701で
外接四角形のYmaxを固定し、X軸の1ライン上をX方
向にサーチをし、各画素の有無を調べ、ステップS70
2で存在する画素のX方向のアドレスを保存する。そし
て、ステップS703でX方向の画素が1画素のみか否
かを判断し、1画素のみの場合は、ステップS704で
該画素のアドレスを、即ち、(X,Ymax )を頂点の座
標とする。また、X方向に複数の画素が存在している場
合は、ステップS705で最大Xmax と最小Xmin の平
均値を求め、ステップS706で該平均値を採用し、
((Xmax +Xmin )/2,Ymax )を頂点の座標とす
る。こうして、図4の状態(b)における四角形ワーク
1の頂点が求まる。
Further, in FIG. 7, Ymax of the circumscribing quadrangle is fixed in step S701, a search is made on one line of the X axis in the X direction to check the presence or absence of each pixel, and step S70
The address of the pixel existing in 2 in the X direction is stored. Then, in step S703, it is determined whether or not there is only one pixel in the X direction. If there is only one pixel, in step S704, the address of the pixel, that is, (X, Ymax) is set as the coordinate of the vertex. If there are a plurality of pixels in the X direction, the average value of the maximum Xmax and the minimum Xmin is calculated in step S705, and the average value is adopted in step S706.
Let ((Xmax + Xmin) / 2, Ymax) be the coordinates of the vertex. In this way, the vertex of the square work 1 in the state (b) of FIG. 4 is obtained.

【0039】そして、図8において、ステップS801
では無条件で外接四角形(Xmin,Ymax )を頂点の座
標とする。こうして、図4の状態(c)における四角形
ワーク1の頂点が求まる。
Then, in FIG. 8, step S801.
Then, the circumscribed quadrangle (Xmin, Ymax) is unconditionally used as the coordinate of the vertex. In this way, the vertex of the square work 1 in the state (c) of FIG. 4 is obtained.

【0040】上記のようにして、第一のCCDカメラに
よる画像入力の処理が終了した後に、同様にして第二の
CCDカメラによる画像入力の処理を行ない、四角形ワ
ーク1の2つの頂点の座標を各々求める。そして、この
2つの頂点座標から四角形ワーク1の中心座標及び傾き
を検出する。なお、この中心位置座標の検出及び傾きの
検出は、数学的手法により容易に求めることができるの
で、ここでは説明を省略する。
After the image input processing by the first CCD camera is completed as described above, the image input processing by the second CCD camera is similarly performed, and the coordinates of the two vertices of the square work 1 are determined. Ask each. Then, the center coordinates and the inclination of the square work 1 are detected from the coordinates of these two vertices. Since the detection of the center position coordinates and the inclination can be easily obtained by a mathematical method, the description thereof will be omitted here.

【0041】このように、本実施例の画像処理装置は、
四角形ワーク1の2頂点の画像を各々取込む第一及び第
二の2台のCCDカメラからなる画像入力手段と、前記
2台のCCDカメラ(画像入力手段)で取込んだ2頂点
の画像データを基にして、2値化処理、ランレングスア
ドレス作成処理、外接四角形抽出処理、及び図5から図
8の頂点算出処理により2頂点の座標を求め、この2つ
の頂点座標から前記四角形ワーク1の位置及び傾きを検
出する位置・傾き検出手段とを備えている。
As described above, the image processing apparatus of this embodiment is
Image input means composed of first and second two CCD cameras for respectively capturing images of two vertices of the square work 1, and image data of two vertices captured by the two CCD cameras (image input means). Based on the above, the coordinates of the two vertices are obtained by the binarization process, the run length address creation process, the circumscribing quadrilateral extraction process, and the vertex calculation process of FIGS. And a position / tilt detecting means for detecting the position and the tilt.

【0042】即ち、本実施例の画像処理装置は、2台の
CCDカメラで四角形ワーク1の2頂点の画像を各々取
込み、この2頂点の位置座標を検出し、この位置座標か
ら四角形ワーク1の位置及び傾きの検出を行なうもので
ある。
That is, the image processing apparatus of the present embodiment captures images of two vertices of the quadrangle work 1 with two CCD cameras, detects the position coordinates of these two vertices, and detects the position coordinates of the quadrangle work 1 from the position coordinates. The position and the inclination are detected.

【0043】したがって、従来のように1台のCCDカ
メラで四角形ワーク1の全体像を撮像し、得られた画像
データを利用して四角形ワークの位置、傾きを求めるも
のではないので、CCDカメラの視野に収まらない大形
の四角形ワーク1の位置及び傾きの検出ができる。ま
た、2台のCCDカメラを四角形ワーク1の2つの頂点
に適宜接近させることにより、CCDカメラの画像の分
解能に拘りなく、単位画素当りのミリ数の調整ができる
ので、出力結果の精度を上げることができる。このた
め、画像の分解能の影響を受けることなく精度良く四角
形ワーク1の位置及び傾きを検出できる。この結果、適
用範囲が拡大し、高精度を要する四角形ワーク1の位置
及び傾きの検出ができる。
Therefore, it is not necessary to take the whole image of the square work 1 with one CCD camera and to obtain the position and inclination of the square work using the obtained image data as in the conventional case. It is possible to detect the position and inclination of the large quadrangle work 1 that does not fit in the field of view. Further, by appropriately bringing the two CCD cameras close to the two vertices of the square work 1, the number of millimeters per unit pixel can be adjusted regardless of the resolution of the image of the CCD camera, so that the accuracy of the output result is improved. be able to. Therefore, the position and inclination of the square work 1 can be accurately detected without being affected by the image resolution. As a result, the applicable range is expanded, and the position and inclination of the quadrangle work 1 that requires high accuracy can be detected.

【0044】ところで、上記実施例では、四角形ワーク
の2頂点の画像入力を行なう2台のCCDカメラの1台
を固定にし、他の1台をXYテーブル等に取付け、画像
入力位置までCCDカメラを移動させて、2頂点の画像
入力を行ない、処理を行なうようにしても、同様の効果
を得ることができる。
By the way, in the above embodiment, one of the two CCD cameras for inputting the images of the two vertices of the square work is fixed, the other one is attached to the XY table or the like, and the CCD camera is moved to the image input position. The same effect can be obtained by moving the image, inputting images of two vertices, and performing the process.

【0045】また、上記実施例では、四角形ワークの2
頂点の画像入力を対角コーナーで行なったが、四角形ワ
ークの任意の2頂点を選択し、該頂点に対して画像入力
を行ない、処理を行なうようにしても、同様の効果を得
ることができる。
Further, in the above-mentioned embodiment, the square work 2 is used.
Although the image input of the vertices was performed at diagonal corners, the same effect can be obtained by selecting any two vertices of the quadrangle work, performing the image input on the vertices, and performing the processing. ..

【0046】さらに、四角形ワークの2頂点の座標を用
いて、位置及び傾きのみならず、面積や、周囲長等の多
くの特徴量を併せて算出することもできる。
Further, by using the coordinates of the two vertices of the quadrangle work, it is possible to calculate not only the position and inclination, but also many feature quantities such as area and perimeter.

【0047】[0047]

【発明の効果】以上説明したように、本発明の画像処理
装置は、画像入力手段、位置・傾き検出手段とを備え、
画像入力手段で四角形ワークの2頂点の画像を各々取込
み、この2頂点の位置座標を検出し、この位置座標から
四角形ワークの位置及び傾きの検出を行なうことによ
り、画像入力手段の視野に収まらない大型の四角形ワー
クの位置及び傾きを検出できるとともに、画像の分解能
の影響を受けることなく精度良く四角形ワークの位置及
び傾きの検出ができるので、適用範囲が拡大し、高精度
を要する四角形ワークの位置及び傾きの検出ができる。
As described above, the image processing apparatus of the present invention comprises image input means and position / tilt detection means,
By capturing the images of the two vertices of the quadrangle work by the image input means, detecting the position coordinates of these two vertices, and detecting the position and inclination of the quadrangle work from these position coordinates, the image does not fall within the visual field of the image input means. It is possible to detect the position and tilt of a large quadrangle work, and it is possible to detect the position and tilt of the quadrangle work with high accuracy without being affected by the resolution of the image. And the inclination can be detected.

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

【図1】図1は本発明の一実施例である画像処理装置の
処理部及び動作の流を示すフローチャートである。
FIG. 1 is a flowchart showing a flow of processing units and operations of an image processing apparatus which is an embodiment of the present invention.

【図2】図2は本発明の一実施例である画像処理装置に
よる四角ワークの画像入力の概要を示す説明図である。
FIG. 2 is an explanatory diagram showing an outline of image input of a square work by an image processing apparatus according to an embodiment of the present invention.

【図3】図3は本発明の一実施例である画像処理装置に
よる画像入力後に2値化処理をし外接四角形を求めた状
態を示す説明図である。
FIG. 3 is an explanatory diagram showing a state in which a circumscribed quadrangle is obtained by performing binarization processing after image input by the image processing apparatus according to the embodiment of the present invention.

【図4】図4は本発明の一実施例である画像処理装置に
よる四角ワークの画像入力状態を示す説明図である。
FIG. 4 is an explanatory diagram showing an image input state of a square work by the image processing apparatus which is an embodiment of the present invention.

【図5】図5は本発明の一実施例である画像処理装置に
よる画像入力を三種類の状態に振分ける動作を示すフロ
ーチャートである。
FIG. 5 is a flowchart showing an operation of distributing an image input to three types of states by the image processing apparatus according to the embodiment of the present invention.

【図6】図6は図4及び図5の状態(a)の頂点算出処
理動作を示すフローチャートである。
FIG. 6 is a flowchart showing the vertex calculation processing operation in the state (a) of FIGS. 4 and 5;

【図7】図7は図4及び図5の状態(b)の頂点算出処
理動作を示すフローチャートである。
FIG. 7 is a flowchart showing the vertex calculation processing operation in the state (b) of FIGS. 4 and 5;

【図8】図8は図4及び図5の状態(c)の頂点算出処
理動作を示すフローチャートである。
FIG. 8 is a flowchart showing the vertex calculation processing operation in the state (c) of FIGS. 4 and 5;

【図9】図9は従来の画像処理装置による2値画像を示
す説明図である。
FIG. 9 is an explanatory diagram showing a binary image by a conventional image processing apparatus.

【図10】図10は従来の画像処理装置による重心のX
座標を求める処理を示すフローチャートである。
FIG. 10 is an X of the center of gravity by the conventional image processing apparatus.
It is a flowchart which shows the process which calculates | requires a coordinate.

【図11】図11は従来の画像処理装置による重心のY
座標を求める処理を示すフローチャートである。
FIG. 11 is a graph showing Y of the center of gravity by the conventional image processing apparatus.
It is a flowchart which shows the process which calculates | requires a coordinate.

【図12】図12は従来の画像処理装置による傾きを求
める処理を示すフローチャートである。
FIG. 12 is a flowchart showing a process of obtaining a tilt by a conventional image processing apparatus.

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

1 四角形ワーク 2 第一のCCDカメラの視野 3 第二のCCDカメラの視野 4 外接四角形 5 外接四角形 1 square work 2 field of view of first CCD camera 3 field of view of second CCD camera 4 circumscribed quadrangle 5 circumscribed quadrangle

【手続補正書】[Procedure amendment]

【提出日】平成3年12月11日[Submission date] December 11, 1991

【手続補正1】[Procedure Amendment 1]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0005[Correction target item name] 0005

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0005】まず、X座標を算出する方法について述べ
る。図10において、ステップS1001でX方向のラ
イン番号nの初期設定をする。そして、ステップS10
02で該X方向のnラインの開始座標及び終了座標(X
s ,Xe)を求め、ステップS1003で該X方向のn
ラインの画素数(pixel)を求め、ステップS10
04で前記nラインの画素数(pixel)をnライン
よりも前迄の画素数に加算し、総画素数(area)を
求め、ステップS1005でgrvを次の(1)式によ
り演算する。 grv=grv+{pixel×(Xs +Xe )}/2 ・・(1)式 なお、このgrvは画素によるY軸に関する面積モーメ
ント(一次モーメント)として把握できる。
First, a method of calculating the X coordinate will be described. In FIG. 10, in step S1001, the line number n in the X direction is initialized. Then, step S10
At 02, the start and end coordinates (X
s, Xe), and n in the X direction is calculated in step S1003.
The number of pixels of the line (pixel) is calculated, and step S10
In 04, the number of pixels of the n line (pixel) is added to the number of pixels before the n line to obtain the total number of pixels (area). In step S1005, grv is calculated by the following equation (1). grv = grv + {pixel × (Xs + Xe)} / 2 (1) This grv can be understood as an area moment (first moment) of the pixel about the Y axis.

【手続補正2】[Procedure Amendment 2]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0007[Correction target item name] 0007

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0007】ここで、図9の2値画像の重心のX座標を
上記方法により算出する。まず、1ライン目の処理で
は、画素が無く、画素数も0であるので、grvも0で
ある。 2ライン目の処理では、Xs =1,Xe =2、pixe
l=2、area=2であるから、grv=0+{2×
(1+2)}/2=3となる。 3ライン目の処理では、Xs =1,Xe =2、pixe
l=2、area=4であるから、grv=3+{2×
(1+2)}/2=6となる。 4ライン目の処理では、Xs =1,Xe =4、pixe
l=4、area=8であるから、grv=6+{4×
(1+4)}/2=16となる。 5ライン目の処理では、Xs =1,Xe =4、pixe
l=4、area=12であるから、grv=16+
{4×(1+4)}/2=26となる。 これで、全てのラインについての処理が終わり、この結
果を利用して重心のX座標gravXを求める処理を行
なう。即ち、gravX=26/12=2.166…と
なり、図9の2値画像の重心のX座標gravX2.
2となる。
Here, the X coordinate of the center of gravity of the binary image of FIG. 9 is calculated by the above method. First, in the processing of the first line, since there are no pixels and the number of pixels is 0, grv is also 0. In the processing of the second line, Xs = 1, Xe = 2, pixel
Since l = 2 and area = 2, grv = 0 + {2 ×
(1 + 2)} / 2 = 3. In the processing of the third line, Xs = 1, Xe = 2, pixel
Since l = 2 and area = 4, grv = 3 + {2 ×
(1 + 2)} / 2 = 6. In the processing of the fourth line, Xs = 1, Xe = 4, pixel
Since l = 4 and area = 8, grv = 6 + {4 ×
(1 + 4)} / 2 = 16. In the processing of the fifth line, Xs = 1, Xe = 4, pixel
Since l = 4 and area = 12, grv = 16 +
{4 × (1 + 4)} / 2 = 26. This completes the processing for all the lines, and the processing for obtaining the X-coordinate gravX of the center of gravity is performed using this result. That is, gravX = 26/12 = 2.166 ..., and the X coordinate of the center of gravity of the binary image in FIG. 9 gravX = 2.
It becomes 2.

【手続補正3】[Procedure amendment 3]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0008[Correction target item name] 0008

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0008】次に、Y座標を算出する方法について述べ
る。図11において、ステップS1101でX方向のラ
イン番号nの初期設定をする。そして、ステップS11
02で該X方向のnラインの開始座標、終了座標(Xs
,Xe )及びY座標(Y)を求め、ステップS110
3で該X方向のnラインの画素数(pixel)を求
め、ステップS1104で前記nラインの画素数(pi
xel)をnラインよりも前迄の画素数に加算し、総画
素数(area)を求め、ステップS1105でgrv
を次の(3)式により演算する。 grv=grv+(pixel×Y) ・・・(3)式 なお、このgrvは画素によるX軸に関する面積モーメ
ント(一次モーメント)として把握できる。
Next, a method of calculating the Y coordinate will be described. In FIG. 11, in step S1101, the line number n in the X direction is initialized. Then, step S11
02, the start and end coordinates (Xs
, Xe) and the Y coordinate (Y) are obtained, and step S110
3, the number of pixels of the n lines in the X direction (pixel) is obtained, and in step S1104, the number of pixels of the n lines (pi).
xel) is added to the number of pixels before the nth line to obtain the total number of pixels (area), and grv is calculated in step S1105.
Is calculated by the following equation (3). grv = grv + (pixel × Y) Equation (3) Note that this grv can be understood as an area moment (first moment) of the pixel about the X axis.

【手続補正4】[Procedure correction 4]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0010[Correction target item name] 0010

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0010】ここで、図9の2値画像の重心のY座標を
上記方法により算出する。まず、1ライン目の処理で
は、画素が無く、画素数も0であるので、grvも0で
ある。 2ライン目の処理では、Xs =1,Xe =2、Y=1、
pixel=2、area=2であるから、grv=0
+2×1=2となる。 3ライン目の処理では、Xs =1,Xe =2、Y=2、
pixel=2、area=4であるから、grv=2
+2×2=6となる。 4ライン目の処理では、Xs =1,Xe =4、Y=3、
pixel=4、area=8であるから、grv=6
+4×3=18となる。 5ライン目の処理では、Xs =1,Xe =4、Y=4、
pixel=4、area=12であるから、grv=
18+4×4=34となる。
Here, the Y coordinate of the center of gravity of the binary image of FIG. 9 is calculated by the above method. First, in the processing of the first line, since there are no pixels and the number of pixels is 0, grv is also 0. In the processing of the second line, Xs = 1, Xe = 2, Y = 1,
Since pixel = 2 and area = 2, grv = 0
+ 2 × 1 = 2. In the processing of the third line, Xs = 1, Xe = 2, Y = 2,
Since pixel = 2 and area = 4, grv = 2
+ 2 × 2 = 6. In the processing of the fourth line, Xs = 1, Xe = 4, Y = 3,
Since pixel = 4 and area = 8, grv = 6
+ 4 × 3 = 18. In the processing of the fifth line, Xs = 1, Xe = 4, Y = 4,
Since pixel = 4 and area = 12, grv =
18 + 4 × 4 = 34.

【手続補正5】[Procedure Amendment 5]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0011[Correction target item name] 0011

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0011】これで、全てのラインについての処理が終
わり、この結果を利用して重心のY座標gravYを求
める処理を行なう。即ち、gravY=34/12=
2.833…となり、図9の2値画像の重心のY座標g
ravY2.8となる。したがって、図9の2値画像
の重心座標(gravX,gravY)は(2.2,
2.8)となる。
With this, the processing for all the lines is completed, and the result is used to perform the processing for obtaining the Y coordinate gravY of the center of gravity. That is, gravY = 34/12 =
2.833 ... and the Y coordinate g of the center of gravity of the binary image in FIG.
rabY = 2.8. Therefore, the barycentric coordinates (gravX, gravY) of the binary image in FIG. 9 are (2.2,
2.8).

【手続補正6】[Procedure Amendment 6]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0016[Correction target item name] 0016

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0016】したがって、傾き(θ)は、 θ=(1/2)tan-1{(2×5.08)/(−2
4.08−51.92)}−3.81(度)となる。
こうして、図9の2値画像の傾き(θ)が求まる。
Therefore, the slope (θ) is θ = (1/2) tan -1 {(2 × 5.08) / (-2
4.08-5.92)} −3.81 (degrees).
In this way, the inclination (θ) of the binary image in FIG. 9 is obtained.

【手続補正7】[Procedure Amendment 7]

【補正対象書類名】図面[Document name to be corrected] Drawing

【補正対象項目名】図9[Correction target item name] Figure 9

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【図9】 [Figure 9]

【手続補正8】[Procedure Amendment 8]

【補正対象書類名】図面[Document name to be corrected] Drawing

【補正対象項目名】図10[Name of item to be corrected] Fig. 10

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【図10】 [Figure 10]

【手続補正9】[Procedure Amendment 9]

【補正対象書類名】図面[Document name to be corrected] Drawing

【補正対象項目名】図11[Name of item to be corrected] Fig. 11

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【図11】 FIG. 11

Claims (1)

【特許請求の範囲】 【請求項1】 四角形ワークの2頂点の画像を各々取込
む画像入力手段と、前記画像入力手段で取込んだ2頂点
の画像データを処理して前記四角形ワークの位置及び傾
きを検出する位置・傾き検出手段とを具備することを特
徴とする画像処理装置。
Claim: What is claimed is: 1. An image input unit for capturing images of two vertices of a quadrangle work, and image data of the two vertices captured by the image input unit for processing the position and position of the quadrangle work. An image processing apparatus comprising: a position / tilt detecting means for detecting an inclination.
JP3182306A 1991-07-23 1991-07-23 Image processing device Expired - Lifetime JP2822700B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3182306A JP2822700B2 (en) 1991-07-23 1991-07-23 Image processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3182306A JP2822700B2 (en) 1991-07-23 1991-07-23 Image processing device

Publications (2)

Publication Number Publication Date
JPH0528268A true JPH0528268A (en) 1993-02-05
JP2822700B2 JP2822700B2 (en) 1998-11-11

Family

ID=16115988

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3182306A Expired - Lifetime JP2822700B2 (en) 1991-07-23 1991-07-23 Image processing device

Country Status (1)

Country Link
JP (1) JP2822700B2 (en)

Also Published As

Publication number Publication date
JP2822700B2 (en) 1998-11-11

Similar Documents

Publication Publication Date Title
US6031941A (en) Three-dimensional model data forming apparatus
JPH0895551A (en) Image display device
US20030117516A1 (en) Monitoring system apparatus and processing method
CN115205284B (en) Target object detection method and device, medium and electronic equipment
JPH0810132B2 (en) Target pattern rotation angle detection method
JPH01134573A (en) Image processing method
JPH0528268A (en) Image processing device
JP2667885B2 (en) Automatic tracking device for moving objects
JP2985380B2 (en) Electronic component position detection method
US5471536A (en) Figure digitizing system
JPH05149716A (en) Corner detection method
JPH06259557A (en) Image input device
JPS6322241B2 (en)
JPH11112966A (en) Moving object detecting device, moving object detecting method, and computer-readable storage medium
JPH10340337A (en) Correction method for inclination, extension and contraction of image data of drawing with drawing frame line graphic
JP2000121337A (en) Method and device for image correction
JPS60233503A (en) Position detecting method
JPH04275783A (en) Picture information processor
JPH1069536A (en) Image synthesis device
JP2681087B2 (en) Horizontal line detector
JPH1123241A (en) Object tilt angle measuring method and apparatus, and storage medium
JPH0721383A (en) Picture processor
JPS62239279A (en) Scanning direction changeover system in raster scanning
JPS63254855A (en) Scanning distortion correcting system
JPS6348001B2 (en)