摘要
视觉是人类观察世界、认知世界的重要功能手段,人类感知外部世界主要通过视觉、触觉、听觉和嗅觉等感觉器官,其中80%的信息是由视觉获取的。机器视觉是人类利用计算机实现人的视觉功能—对客观世界三维场景的感知、识别和理解,机器视觉是一个相当新而且发展迅速的研究领域,机器视觉技术正广泛地应用于各个方面,许多人类无法感知的场合(如危险场景感知等),机器视觉更突显其优越性。
本文是国家创新基金项目“全自动防爆定重式液态计量灌装系统”(No.01c26222210304)的机器视觉检测部分,阐述了机器视觉检测算法及其硬件的实现,解决了以下问题:1.工业现场中视频信号的有效提取和准确识别;2.摄像机参数的快速标定,包括摄像机模型数字化及模型中各参数的在线调整;3.实现灌装过程自动化。4.人机交互界面的设计。
系统的算法实现包括摄像机校正、图像的增强处理、图像的特征提取及二轴步进电机控制。
首先,在本自动灌装系统中,由于灌装系统精度要求较高,并且采用单摄像机系统,所以必须考虑摄像机的镜头失真等一些因素,因而采用通用摄像机模型,对坐标变换中的参数进行校正。从3-D世界坐标到计算机图像坐标的变换中所需校正的参数共有11个,其中有5个内部参数:焦距,镜头失真系数,不确定性图像尺度因子、图像平面原点的计算机图像坐标和,6个外部参数:中的3个欧拉角(、、)和中的三个元素(、、),本系统中我们采用基准校正法:在摄像机前放一个已知形状和尺寸的物体,称为标定物或标定参照物,通过软件在线调整相应的校正参数,并根据最小均方误差原理,使得系统达到较好的校正精度。
其次,由于摄像机摄入的图像受到现场噪声的影响,为了便于图像的后处理,必须对图像进行滤波处理。本系统摄取的灰度图像中,图像的边缘细节信息较少,现场中脉冲噪声和椒盐噪声对它们影响较大,直接影响到图像质量,我们将平均值滤波器与中值滤波器相结合,提出了一种加权方差混合滤波算法,设计了一种基于平均滤波和中值滤波的混合滤波器。均值滤波器由于其直观简单且计算速度快,因而在图像去噪中得到广泛应用。但它也存在着很大的缺点,比如它存在模糊效应,使图像的边缘和细节变得模糊不清。而以中值滤波器为代表的非线性滤波器,在抑制随机噪声的同时还能保持图像的边沿不受模糊,尤其是中值滤波器对脉冲噪声和椒盐噪声有很好的抑制效果,这是因为它不依赖于邻域内那些与典型值差别很大的值;但它对含有高斯噪声的细节较少的图像,滤波效果则不如平
均值滤波器。在混合滤波器中,我们利用图像的方差来与滤波器的阈值相比较。这是因为图像的方差在很大程度上反映了图像细节的丰富程度,图像的方差小,说明图像的细节比较少,方差大说明图像的细节比较多,所以选取图像的方差作控制参数可以使平均值滤波器和中值滤波器发挥各自的优势,达到更好的滤波效果。
第三,对于摄入的图像,需借助一定的算法进行分析,得到所需的信息。本系统中需从摄入图像中识别桶口位置、进料管位置信息,从而驱动进料管灌装。
首先,我们对常用的边缘检测算子进行比较,确定应用Sobel算子对图像进行边缘检测,它不但能够清晰地检测出图像的边缘信息,而且为后续算法提供了梯度信息。
之后,应用哈夫变换检测桶口中心与进料管位置。
1.系统中被检测的圆桶具有显著的几何特征:桶中心和桶口中心有着比较稳定的距离尺度关系,并且油桶直径及桶口直径的尺度范围均为已知,所以,本系统的设计思想是:首先判别油桶桶中心的位置范围,然后由桶中心和桶口中心的约束尺度关系识别桶口位置。我们应用边缘检测算法得到的梯度信息来减少自由度数量的约束,并且利用圆周的极坐标方程,从而减少求取哈夫变换所需的计算量。
2.对于进料管的检测,系统中为了检测方便,在进料管上标示了坐标参考标识,其平面与摄像机光轴垂直,且其直角点与进料管管口位置固定,因而,在检测过程中,只要检测到直角点位置,即两条直角边的交点,就可以确定进料管管口位置。在检测过程中,我们做如下改进,因为每次灌装完成后进料管自动归位,其位置比较固定,因而将进料管标识的检测,即两条直角线的检测只限制在初始位置周围固定的区域进行检测,并且我们将其颜色定义为光敏感色,可以清晰地检测出其边缘,因而Hough变换可以准确的找出两条直角边的位置。
本系统硬件部分主要由机器视觉检测单元、进料管行走单元、计量单元、传输控制单元和主控制柜组成,根据系统设计的需要,我们给出了系统的硬件框图,并且详细阐述了各部分的设计及器件选择。
通过实验验证本系统达到了系统性能的要求,很好地解决了工业现场液态原料灌装现场劳动强度大、效率低下的不足,同时大大减轻了有毒、腐蚀性强、易燃、易爆等液态原料灌装过程中对操作人员人身安全的威胁和危害,有着极大的经济效益和社会效益。
Vision is an important media for people to observe and realize the world. People feel the world through vision, feeling, hearing and smelling, however, 80 percents of the information is gotten through vision. Computer vision is the way that people use computer to realize their vision, which is the feeling, recognition and comprehension of objective in the real world. Computer vision is a new and rapidly growing research field, and it is widely used in many areas. Computer vision techniques will show their predominance in some situation that can’t be felt by people, such as the detection of danger and so on.
This paper is about the computer vision, which is part of the national creative fund project “Automatic Anti-explosive and Volume Measurable Pot Feeding System ”. We applied the algorithm of the computer vision and achieved the hardware design and it solved the problems as follows:
1. Effective extraction and accurate recognition of the video signal in industry spot.
2. The rapid calibration of the camera parameters and it includes digital camera model and on-line debug of each parameter.
3. Complement the automatic pot feeding process.
4. The design of the interface between people and computer.
The system algorithm includes the calibration of the camera, the enhancement of the image, the extraction of the image feature and the control of the bi-axis step motor.
Firstly, because of the request for high precision of the pot feeding process and the application of the single camera in this system, we must allow for the distortion of the shot. So we calibrated the parameters of the camera through the general camera model. 11 parameters are necessary for the transmission from the 3-D world coordinate to the computer image coordinate, among which 5 are inner parameters. They are focus , shot distortion parameter, undetermined image scale parameter and the computer image coordinate and of the image origin. The other external parameters are : three Oula angles(、、)in and three parameters(、、)in . In this system we applied template based calibration: Put an object with the known shape and size in front of the camera, which is called the calibrated object. Specify the calibrating parameters
through online software and with the least mean square error theory we have the optimum accuracy for the system.
Secondly, we must do filter process to the input image because of the noise from industry spot so as to prepare for the subsequent process. There aren’t too much edge information in input gray image while the pulse noise and pepper and salt noise in the spot have great influence on it, it will lead to bad quality. So we think of blending the average filter and median filter into a blend filter and design a blend filter. Average filter is used widely in image processing for its simpleness and high speed. However it has its own shortness such as its blur effects and blurring the edge and details of the image. While some nonlinear filters such as median filter can suppress the random noise especially pulse noise and pepper and salt noise without blurring the image edge. But it’s not as good as the average filter when used to little detail image with gauss noise. In blend filter, we select square error of the image to compare with a threshold because it reflects the abundance of image detail, more detail, bigger . Selecting as control parameter can make average filter and median filter exert their own advantage to get better filter result.
Thirdly, for the captured image, we should analyze it with some algorithm to get the necessary information. In this system, the position of the pot and the information of the poison of the feeding pipe should be gotten from the input image, so as to drive the feeding pipes to feed the pot.
First we compared several general edge detection operators and chose the Sobel operator because it can not only detect the clear boundary but also provide the grads information.
Then we detect the center of the pot and the position of the feeding pot through
引文
[1]贾云德,机器视觉,科学出版社,2000
[2]郑南宁,计算机视觉与模式识别,国防工业出版社,1998
[3]马颂德,张正友,计算机视觉,科学出版社,1998
[4]吴立德,计算机视觉,复旦大学出版社,1993
[5]李介谷,计算机视觉的理论与实践,上海交通大学出版社,1991
[6]P.J.Besl, Active, optical range imaging sensors, Machine Vision and Applications, 1:127-152
[7]Shapiro L, Rosenfeld A(eds). Computer Vision and Image Processing. Academic Press
[8]D.H. Ballard and C.M. Brown, Computer vision, Prentice-Hall, Englewood Cliffs, New Jersey,1982
[9]王润生,图像理解,国防科技大学出版社,1995
[10]章毓晋,图像工程(上、下册),清华大学出版社,2000
[11]Marr D. Vision-A Computational Investigation into the Human Representation and Processing of Visual Information, W.H.Freeman, San Francisco,1982
[12]Tsai R Y. An Efficient and Accurate Camera Calibration Technique for 3D Machine Vision. Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, Miami Beach,FL,1986,pp.364-374
[13] Tsai R Y. A Versatile Camera Calibration Technique for High-Accuracy 3D Machine Vision Metrology Using Off-the shelf TV Cameras and Lenses. IEEE Journal of Robotics and Automation, VOL. RA-3, NO.4, August 1987, pp. 323-344.
[14]I.Sobel, Camera models and machine perception, Stanford AI Memo 121,May 1970
[15]D.C.Brown, Close-range camera calibration, Photogrammetric Eng., Vol.37, pp.855-866,1971
[16]M.T.Ahmed, E.Hemayed and A.Farag, Camera calibration with lens distortion using weakly-localized image features, Proc. Of SPIE,3650:119-127,1999
[17]荆仁杰,叶秀清,徐胜荣,陈存椿,计算机图像处理,浙江大学出版社,1995
[18]M J McDonnell, Box filtering techniques, Computer Graphics and Image Processing,17(3):65-70,1981
[19] Wang D C C, Vagnucci A H, L C C. Gradient inverse weighted smoothing scheme and evaluation of its performance. 1981, CGIP 16:167-181
[20] Tomita F, Tsuji S. Extraction of multiple regions by smoothing in selected neighborhoods. IEEE Trans. Sys. Man Cybern, 1977, 7:107-109
[21] M Nagao,T Matsuyama, Edge preserving smoothing. 1977,CGIP 9:394-407
[22]M Nagao,T Matsuyama, A structural Analysis of Complex Aerial Photographs, Plenum Press, New York,1980
[23] Terence Wang, Chin-Liang Wang. A new two-dimensional block adaptive FIR filtering algorithm and its application to image restoration. IEEE Trans. image processing, 1998,7:238-246
[24]Pitas I. Venetsanopoulos AN. Nonlinear digital filters principles and applications. New York : Kluwer Academic Publishers,1990
[25]Tukey J.W. Exploratory data analysis. Addison-Wesley,1977
[26]S G Tyan, Median filtering, Deterministic Properties, In TS Huang, editor, Two-dimensional Digital Signal Processing, Volume II, Springer Verlag, Berlin,1981
[27] 吴小培,黄端旭,汪炳汉. 图像细节保持中值滤波器. 图像图形学论文集-第五届全国图像图形学学术会议,第一卷:38-43
[28]Jaakko Astola, Petri Haavisto, Yrj? Neuvo. Vector median filter. Proceedings of the IEEE, 1990, 78:678-689
[29]陈贺新,非线性滤波器与数字图像处理, 国防工业出版社,1997
[30]Lin Yin, Ruikang Yang, Moncef Gabbouj, Yrj? Neuvo. Weighted Median Filters: A Tutorial. IEEE Transaction on circuits and systems-Ⅱ:Analog and digital signal processing,1996,43:157-191
[31]Tao Chen, Kai-Kuang Ma, Li-Hui Chen. Tri-state median filter for image denoising. IEEE Trans. image processing, 1999,8:1834-1838
[32]Weeks AR. Fundamentals of electronic image processing. New York:SPIE OPTICAL Eng Press, 1997
[33]Kenneth R Castle. Digital Image processing. Prentice Hall.1995
[34]Pratt WK. Digital Image processing, John Wiley & Sons. Inc
[35]徐建华,图像处理与分析,科学出版社,1992
[36]张远鹏,董海,周文灵,计算机图像处理技术基础,北京大学出版社,1996
[37]夏德深,傅德胜,现代图像处理技术及应用,东南大学出版社,1997
[38]崔屹,数字图像处理技术与应用,电子工业出版社,1997
[39]阮秋琦,数字图像处理学,电子工业出版社,2001
[40]容观澳,计算机图像处理,清华大学出版社,2000
[41]A Rosenfeld and A C Kak, Digital Picture Processing, Academic Press, New York,2nd edition,1982
[42]Pitas I. Venetsanopoulos AN. Order statistics in digital image processing. Proceedings of The IEEE,1992,20(12):1893-1921
[43]王积分,张新荣,计算机图像识别,中国铁道出版社,1998
[44]Hall E L. Computer Image Processing and Recognition. Academic Press,1979
[45]PVC Hough, A method and Means for Recognizing Complex Patterns, US patent
3069654,1962
[46]Ballard D.H. Generalizing the Hough transform to detect arbitrary shapes. 1981.PR, 13:111~122
[47]傅卓,章毓晋,一种新的亚象素边缘检测算法及其性能研究,电脑应用技术,1995,35:1~5
[48]R O Duda and PE Hart, Using the Hough transforms to detect lines and curves in pictures, Communications of the ACM,15(1):11-15,1972
[49]R O Duda and PE Hart, Pattern Classification and Scene Analysis, Wiley, New York,1973
[50]S Y K Yuen and V Hlavac, An approach to quantization of the Hough Space, In Proceedings of the 7th Scandinavian Conference on Image Analysis, Aalborg, Denmark, Pages 733-740, Pattern Recognition Society of Denmark, Copenhagen, Copenhagen, Denmark, August,1991