Научная статья на тему 'Разработка программного обеспечения для геометрических преобразований в машинном зрении'

Разработка программного обеспечения для геометрических преобразований в машинном зрении Текст научной статьи по специальности «Компьютерные и информационные науки»

CC BY
94
17
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
РАЗРАБОТКА ПО / ПРОЦЕСС CNC / DELPHI 7 / ГРАВИТАЦИЯ

Аннотация научной статьи по компьютерным и информационным наукам, автор научной работы — Jiang Xiangang, Xu Miaocun, Jiang Xiaojun

Рассматриваются цифровые методы обработки изображения. Показана возможность преобразоватния искаженного изображения в оригинальное. Процесс преобразования разделен на два шага: (1) геометрическое преобразование, использующее отношение координат между оригинальным изображением и искаженным изображением. Описано правило искажения при геометрических преобразованиях в системе координат. (2) калибровка шкалы яркости. Экспериментальный результат демонстрирует, что ошибка при установке не будет превосходить 0.1mm при условии, если целевое изображение точно. Для проектирования модулей системы программного обеспечения используется Delphi 7.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «Разработка программного обеспечения для геометрических преобразований в машинном зрении»

Agent from the micro-economic simulation modelASPEN model developed by U.S. Sandia Labs, is composed by the Resource Agent, the Resource Providing Negotiation Agent, the Job Agent and the Resource Request Negotiation Agent etc. The system has been simulating for more than 10 years, the refresh rate is 1. (Refreshed after each simulation cycle time) When booting the simulation experiment system, each Agent will be in accordance with the pre-set behavior schedule which is the action-interaction observing window and the change of transaction aggregate through computer. The results of experiment are shown in Figure2.

Agent service request to the target host, the Agent can access to the resource of host directly, and reduce the interaction with resource host. Because of the above reasons, which avoid of lots of data transmissions in the Network, reduces the strict requirement to the Network bandwidth, cuts down on the delay time, and improves the service response speed. In addition, each Agent is able to Asynchronous and autonomy execute on multiple heterogeneous network hosts. We can complete the tasks through implanting to the mobile agent.

REFERENCES

vs. time

-¡equirernent

outpu!

|—i-J-¡ ¡ i -

a ion 2BO son

time

Fig. 2. Simulation results of the system

6. Conclusion

Applying the Mobile Agent technology into Grid Computing Resource Management can build a dynamic self-adaptive resource environment. The advantages of Mobile Agent include: the flow of data on the network can be greatly reduced. Through move

1. Frank Griffel, M. Tuan Tu, Malte Munke. Electronic Contract Negotiation as an Application Niche for Mobile Agents // IEEE, 2000.

2. Zhu Lili, Xiong Qianxing. Technology of Mobile Agent in the Application of Electronic Business // Computer & Digital Engineering. 2008. № (4). P. 165-166.

3. Liu Gao-yuan, Liu Jue-fu. Research of Gird Service Based on Web Service // Jounal of East China Jiaotong University. 2008. № (4). P. 71-73.

4. Ma Yin-qiu, Wu Di. Realization of Resource Searching Based on Mobile Agent and AJAX // Microcomputer Information. 2008. № (4). P. 7173.

5. Jain P. Kircher M. Leasing Pattern. Sandholm TW // PLOP 2000 conference. USA. Illionis : Aller-tonPark, 2000. P. 326-328.

Jiang Xiangang, Xu Miaocun, Jiang Xiaojun

Y^K 004.413

SOFTWARE DESIGNING OF GEOMETRY DISTORTION ADJUSTMENT IN MACHINE VISION

1.Introduction

The images are needed for accurate calibration in CNC process based on machine vision dealing with recorded images by one or more quality demotions and identifying the position of certain surface characteristic points, so that the handled images can max-imumly match the original feature and achieve accurate resoration. The digital image processing methods

can transform distorted image into the original image. The transformation process is divided into two steps: (1) geometric transformation. Transformation by using the coordinates relationship between the original image and the distorted image, which means the rule of the distortion makes geometric transformations on the coordinates space where image distortions lie. (2) gray-scale calibration. If the transformed coordinates

ИРКУТСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ПУТЕЙ СООБЩЕНИЯ

are not exactly on the pixel points of ideal image, the gray scale of the corresponding pixel points of the ideal image can be used to estimate the gray scale of that point, thus the corresponding gray scale of the distorted image can be gained. The experimental result demonstrates that the alignment error will not surpass 0.1mm on condition that the target image is accurate. The designing of software system modules uses Delphi 7.

2. Geometry distortion adjustment analysis on machine vision

2.1. General reasons of image geometry distortion

The degradation of image correction is trying to use some kind of priori knowledge of the phenomenon (that is, the degradation of the model)to reconstruct or restore the degraded image.The causes of degradation of image varies, for example,the effects of atmospheric turbulence, the non-linear of sensor characteristics, optical system aberration and the relative motion between imaging equipment and objects and etc.. The causes of degradation need to be ascertained when image correction works, the corresponding correction model needs to be established, then the image can be recovered by following the reverse process of image lowering quality.

Among image distortions caused by machine vision, a very important part is from the optical distortion error, which affects the quality of pixel point coordinates. The optical distortion is divided into radial distortion and eccentric distortion. The radial distortion in general which dues to the defects caused by the lens shape, mainly has something to do with distance between the image point and the main point, and causes the conformation point deviating from its ideal accurate location along the radial direction. Therefore, radial distortion is the main component of distortion, whose deformation rule basically embodies the rule of the camera distortion. Camera distortion can be divided into the barrel distortion and pincushion distortion according to the positive or negative factors of coefficient.

2.2.Two geometric distortion correction algorithms

The affine model and the grid model are established from the above main reasons of the image distortion in machine vision. In order to realize both the algorithm and experimental results comparson, the writer uses different algorithm to design and process the methods.

Affine model uses affine transformation which is contrary to the distortion to offset the image distortion: firstly, restore the image's deformation angle, and then transform the image's distance. Here set the image's upper left corner as the coordinates origin, extract five round focus from the distortion image,

calculate the connection slope between two centers according to clockwise direction, and then use affine transform to realize rotation, translation and correction of the image.

Grid model uses image center as the coordinates origin, and uses grid to cover target to intake the distorted images with grid, because the geometric distortion is not symmetrical on the origin, it is reasonable to divide the whole image into four equal parts and recover each part of the image respectively. 3. Machine vision system's geometry correction programming

This article adopts 1024 x 768 pixel precise circular targets, Fig. 1 and Fig.2 are the pictures of target and distorted images of the target by accurately mapping and extracting respectively.

Fig. 1. Target

Fig. 2. Distorted image

3.1. Common characteristics and parameters in geometric correction

1) Conversion of computer image coordinate system and coordinate system

As the computer coordinate system focuses on the image's upper left corner as the origin, horizontal right as abscissa axis, and vertical downward as ordinate axis, the above target and its coordinates are used only in the image coordinate system. If using in the computer coordinates, conversion should be done based on the relationship of computer coordinate system and real world image coordinate system.

u , v axis parallel to x, y axis separately. The intersection point of image sensor optical axis and image plane is located in the image center O'. But because the image system has certain geometry nonlinear, the deviation from the original point is resulted in the end. The transformation formula from the image coordinate system to the computer coordinate system is as following:

u = x - o.

(1)

V = y - o

СИСТЕМНЫМ АНАЛИЗ И МЕЖДИСЦИПЛИНАРНЫМ ПОДХОД В ИССЛЕДОВАНИЯХ

X = •

S f (X, у) S f (X, y)

3) Distortion rate

П-H

D = -x 100%

H

(2)

(3)

In the formula, n represents the practical image formation height; H represents the ideal image formation height; D is distortion rate.

According to this definition, when pincushion distortion happens, the practical image formation height is greater than the ideal image formation height, as shown in the image pixel location is stretched; When barrel distortion happens, the reverse appears,that is the practical image formation height is less than the ideal image formation height, as shown as compressed images, and pixel moves to the center.

4)Precise calculation

tVcx^Xy^Gy-r)1

J = ^-x 100% (4)

S V(X - X)2 - (y - y )2

i=1

2) Center of gravity

The row coordinate and columned coordinate of gravity are calculated by the following formula:

_ Zxf (x y) - Z yf (x y)

Xi'

y,

a,

+

Lb, J

(5)

cos 0i sin - sin^ cos^

(i = 1,2,3,4,5) Transform the first round focus coordinates (x1, y1) to a new coordinates (xj, yj ), the remaining four new coordinates can be achieved in the same way: (x2,y2),(x3,y3),(*4,y4),(x5,y5) ( in normal circumstances, the value of 0i, ai, bt for each round is

different), the new coordinates are five round centers of gravity in recovered image.

Fig.3 shows the corrected image after using this method. The white-points are the location of the target image after correction. Fig.4 is the recovered one of distorted image location after the inverse transform by formula (5). The white points are the recovery location of the distorted image.

Consider five circles in target as samples, of which the gravity center of i sample is (xi, yi). xi and

yi are the two characteristic values of the sample, and the average of sample mean is the cluster center these five samples in the feature space. (xi3 y^is the gravity coordinates of i sample in the corresponding revision image; (x , y) is the cluster center of these five samples of revised image in the feature space. 3.2 The affine model of plane space and image

This model mainly uses the affine transformation, which is one kind of linear transformation between two-dimensional coordinates maintaining "straight line" and "parallelism" of two-dimensional graphics, and achieving through the compound of a series of atom transformation, including translation, scale, flip, rotation and shear. Rotation and translation are effective to deal with the distorted images mentioned in this article. So the key of image correction is to find corresponding affine transformation.

For the given distorted image, the distortion extent of circles in different positions is not same. Calculating the angle of connection line of two circle gravity centers with clockwise can gain five pairs of sine and cosine. Use the first pair and affine transformation formula:

Fig. 3. The effect image of affine model of image distortion correction

Fig. 4. The position restoration image after affine inverse transformation

3.3. The 4 x 4 grid model of image

Cover precise circular target with 4 x 4 grid, as shown in Fig.5. Each small grid in the precise circular target is uniform square of 256 x 192 pixel. The grid

ИРКУТСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ПУТЕЙ СООБЩЕНИЯ

taken from distorted image is the grid having the same distortion. Formula (1) can realize the transformation between the computer coordinate system and the image coordinate system, make the origin coordinates as the distorted image center (with a certain deviation), and then correct the position to make it a real image center, and divide the whole image into four equal parts based on the center. Select a quarter part from the distorted image to correspond to the 11 parts of target in Fig. 6.

А 12

* г •

4 к #

» 22

Fig. 5. The target covered with 4 x 4 grids

(6)

carry out center hole process. In addition, the article also makes experiments by using 8 x 8 grid to cover precise round target. The experimental data are showed in Table 3.

UtMK*>iUntKt ■MUMunev ШМШИМШШ *«***<. ПШНШМК! ^ /"Л

ТСЧИГ 1 |ilWHHIiHIHg

ШМ11И 1 |tmn шипит

V ЯМ ЯШпАЛМ рм "

Fig. 7. The effect image of 4 x 4 grid model of distorted image

Fig. 6. The 1/4 part on distorted image

Taking into account that there are small triangles formed by three adjacent grid points in each vertex of this image part, whose positions in the distorted image are (r1, s^, (r2, s2 ), (r3, s3), And suppose the ideal coordinates of these spots in specification grid are (u1, Vj), (u2, v2), (u3, v3). By linear transformation relations:

f x = ax + by + c [y = dx + ey + f

It can be considered to map three points to the corrected positions, which is consists of three pairs of equations.

f u = ar + bs + c

\ ' . ' ' , (i = 1,2,3) (7)

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

[v = dri + esi + f

Simultaneous solution of these six equations obtains parameters a, b , c, d, e , f . This transformation can be used to correct distortion in the triangle surrounded by connection line of three points in the distortion image. As a result, the above steps can be repeated on each grid point in a group of three to finish all images' geometric adjustment. Fig.7 is the effection diagram after restoration. The cross fork of different colors represent five round centers of the target and calibration images. Fig. 8 shows the operation process chart of using template to locate the target in vision-based NC machining and continually

Fig. 8. The center hole operation plans under NC machining

4. The experimental result and conclusion of geometry distortion adjustment

In this paper, DNC machining manufacturing coding experiments are made to verify the correctness of theoretical analysis. Here gives some experimental results. The precise circular target is used in experiments, shown in Fig. 1. The advantage of selecting such target is that the center can be accurately measured, image distortion can be quantitatively analyzed to reduce data processing error and improve the reliability of experimental results.

Table 1 and Table 2 show that how two models correct the center of the distortion image in the course of the experiment. The experimental data shows that distortion has been significantly reduced and the center has been recovered basically. Table 3 shows two experimental results of the different models.

Table 1

The various shape parameters of the affine model

The center coordinates of five circles

Target

Distorted image corrected image Origin coordinates

(321,132), (322,188), (321,132), (0, 0)

(434, 132), (422, 196), (434,132),

(699,132), (639,212), (699, 131),

(321,510), (284,501), (321,510),

(699, 510) 582, 502) (699,510)

Table 2

The various shape parameters of the grid model

The center coordinates of five circles

Target

Distorted image corrected image Origin coordinates

(-189,-114), (-76, -114),(189, -114), (-189, 264), (189, 264)

(-188,-58), (-88, -50), (129, -34), (-226, 255), (72, 256)

(-189,-114),(-77, -114), (189, -114), (-189, 264), (189, 264) (510,246)

Table 3

Experimental result contrast table

Origin coordinates

Distortionrate beforeadjustment (%)

Adjustment precision(%)

Processing Time(s)

Affine model Affine inverse transformation 4 x 4 grid model 8 x 8 grid model

(0, 0) (0, 0)

-17.195767-17.195767-

99.92600799.151077-

0.825 0.825

(510,246) -17.195767-

(510,246) -17.195767-

As experiment results can be seen from Table 3, because the image in grid model is divided into four equal parts and is corrected separately, the resuming time is relatively longer, but the calibration accuracy has increased in the affine model. If higher accurate level is required , the grid which covers target can be more refined, for example the 8x 8 grid model in this article can do more triangle distortion correction, and increase calibration accuracy again by dividing a sub-grid into 4x 4 grid model.

The grid model distortion expressed by affine transformation and radial distortion expressed by radial differential equation all can be taken as the machine vision analysis in higher efficacy. Grid distortion efficacy is more in tune with the geometric processing and analysising of symmetrical distribution and edge distribution, and radial distortion efficacy is more in tune with the geometric processing and analysis of center distribution. So to different processing requirements, choosing proper methods is very impor-

99.941125- 0.880

99.973903- 1.070

tant. The analysis on the small details in the local part can use local image enlarging display technology to show the center position error. The distortion solution center has been able to meet accuracy requirement that the error is less than 0.1mm.

REFERENCES

1. Jiang Xiangang. The Technology Research on Image Smooth and Medical Organ's 3D Reconstruction Based on Anisotropic Diffusion // Journal of Irkutsk State University of Railway Transport. 2008. № 2 (18). P. 82-86.

2. Jiang Xiangang. Research on Automatic Detection System Design of rolling Bearing's Surface Defects Based on Neural Network // The First International Symposium on Innovation & Sustai-nability of Modern Railway conference. 2008. P. 556-560.

i Надоели баннеры? Вы всегда можете отключить рекламу.