1.1影像测量仪机器视觉检测
1.1.1机器视觉
机器视觉是研究用相机和计算机来模仿人的眼睛和大脑完成对目标的识别、跟踪和测量等任务的科学【11。由于机器视觉涉及到多个学科,给出一个精确的定义是很困难的。美国制造工程师协会(SME)机器视觉分会和美国机器人工业协会(RIA)自动化视觉分会关于机器视觉的定义是:“机器视觉是使用光学器件进行非接触感知,自动获取和解释一个真实场景的图像,以获取信息或控制机器或过程。”
人们从20世纪50年代开始研究二维图像的统计模式识别,60年代Roberts开始进行三维机器视觉的研究,70年代中期,Mrr人工智能实验室正式开设《机器视觉》课程,80年代初期开始了全球性的研究热潮,机器视觉获得了蓬勃发展,新概念、新理论不断涌现。伴随着计算机技术的不断提高和图像处理与传输技术的日益成熟,机器视觉在生产实践中的应用也加快了步伐。现在机器视觉已经广泛地用于工业、农业、军事、航空、医学等领域中。同时,机器视觉在理论研究上也取得了很大的发展,现在机器视觉涉及了多们学科,包括:光学、机械、图像处理、计算机图形学、模式识别、人工智能、人工神经网络等。
1.1.2机器视觉检测技术
随着制造业的不断发展,先进制造技术的研究和应用越来越广泛。先进制造技术以及自动化制造系统和先进生产模式的推广应用都要求先进的检测手段与之相适应。将机器视觉应用到制造业的检测领域中,用机器视觉系统确定产品相对于一组标准要求的偏差的过程通常称为机器视觉检测2。它特指机器视觉在工业检测方面的应用,是机器视觉应用和研究领域中的一个重要分支。视觉检测就是检测被测目标时,把图像当作检测和传递信息的手段或载体加以利用的检测方法,其目的是从图像中提取有用的信号,它是以现代光学为基础,融合电子学、计算机图像学、信息处理、计算机视觉等科学技术为一体的现代检测技术。由于机器视觉系统可以快速获取大量信息,而且易于与设计信息及加工控制信息集成,基于视觉检测技术的仪器设备能够实现智能化、数字化、小型化、网络化和多功能化,具备在线检测、实时分析、实时控制的能力,在
军事、工业、商业、医学等领域得到广泛关注和应用【3】【4】。机器视觉检测通常涉及指定零件的特征如配件完整性、表面完好性和几何尺寸的测量等。机器视觉检测的工作过程大致为:首先,使用相机将被摄取目标转换成图像信号,传送给专用的图像处理系统,图像系统对这些图像中包含的信息进行处理和计算;然后计算机根据处理的结果做出判断或决策;最后将控制信号传送给执行机构。机器视觉的特点是自动化、客观、非接触和高精度,与一般意义上的图像处理系统相比,机器视觉强调的是精度和速度以及工业现场环境下的可靠性。机器视觉检测与传统的人工检测相比效率更高,检测结果更加准确可靠。由于机器视觉检测不会受到操作者的疲劳度、责任心和经验等因素的影响,在一些不适合人工作业的危险场合,工视觉难以满足要求的场合和带有高度重复性、智能性并且靠人的眼睛无法连续稳定地进行产品检测的场合,机器视觉可以发挥它自身的优势来高效、高质量的完成检测任务。
1.2虚拟仪器
虚拟仪器(virtual Instrument)是日益发展的计算机硬、软件和总线技术在向其它相关技术领域密集渗透的过程中,与测试技术、仪器仪表技术密切结合共同孕育出的一项全新的成果【5】。虚拟仪器利用IO接口设备完成信号的采集与处理,利用计算机的显示功能来模拟传统仪器的控制面板,以多种形式输出检测结果,利用计算机强大的软件功能实现信号数据的运算、分析和处理,从而完成各种测试功能的一种计算机仪器系统。虚拟仪器是现代计算机技术和仪器技术深层次结合的产物,也是当今计算机辅助测试(CAT)领域的一项重要技术。虚拟仪器可利用计算机强大的图形环境和在线帮助功能,构成既有普通仪器的基本功能又有一般仪器所没有的特殊功能的高档、廉价的新型仪器。它可建立中英文界面的虚拟仪器面板,完成对仪器的控制、数据分析和显示,它改变了传统仪器的使用方式,使仪器的功能和使用效率明显提高,大幅度降低了仪器的价格,使用户可以根据自己需要定义仪器的新功能。在虚拟仪器系统中,硬件仅仅是为了解决信号的输入输出,软件才是整个仪器的关键,基于软件体系的结构可以大大节省开发和维护的费用。虚拟仪器的品种多、功能强、自动化程度高、具有良好的人机界面,它与传统仪器的功能是相同的:采集数据,对数据分析处理,以及数据的结果处理。它们之间重要区别之一是灵活性方面。虚拟仪器可由用户自己定义,这意味着用户可以自由地组合计算机平台、硬件、软件以及各种完成应用系统所需要的附件。而这种灵活性在由供应商定义、功能固定的传统仪器中是做不到的。因此,虚拟仪器是仪器发展史上的一场革命,代表着仪器发展的最新方向和潮流,并且是信息技术的一个重要领域,对科学技术的发展和工业生产将产生巨大的作用,将成为仪器发展的方向和趋势。1.3机器视觉检测的发展现状在国外机器视觉检测从上世纪八十年代初开始已经得到了广泛的研究,国内的机器视觉检测研究从上世纪九十年代才逐步开始。当前,随着机器视觉检测系统应用的增加,对机器视觉的研究也越来越多。根据机器视觉的应用领域不同,对机器视觉检测的研究可以分为不同的种类,不同的学者对分类也有不同的见解。文献【4】将工业中应用的机器视觉质量控制系统分为四个类别:尺寸质量、表面质量、装配结构和操作质量。文献61机器视觉的应用领域分为四类:产品检查、机器人、产品分类和其他应用。尺寸测量是机器视觉研究和应用的重要应用领域,也是一个比较早开始的研究的方向。机器视觉应用于尺寸测量工程中时,从机器视觉系统的硬件(光源、图像传感器等)的选用到软件算法的设计中的每一个环节都对最终的性能产生影响。需要根据工程的自身特点选择合适的硬件。文献【7】研究电盘尺寸的检测,采用两个756X581象素的CCD传感器分别采集电盘两个侧面的图像,通过轮廓跟踪、直线分割、和亚象素定位获得工件的尺寸。系统精度达到正负0.3毫米,每个工件检测花费的时间约0.3秒。
文献【8】研究了基于计算机视觉的活塞环闭151间隙测量系统。采用795 X595象素数的CCD传感器,根据活塞环本身几何参数的特点推导出了活塞环各个参数之间的关系。使用了对图像边缘的亚像素定位技术对300微米的开口进行测量,测量系统的测量精度为士47微米。
文献9】研究的机器视觉在线测量系统测量范围从十几丝到30毫米工件的外轮廓,经过实验在同一状态下长时间测量同一工件误差达到±3微米。
总之,机器视觉在高精度的尺寸测量领域有着很大的应用空间,随着机器视觉硬件制造技术的成熟和硬件成本的降低,机器视觉在现代化生产中将应用的越来越广泛,其测量精度也会逐渐提高【10】。
1.4设计的主要内容
在查阅大量国内外文献的基础上设计基于虚拟仪器和机器视觉技术的机械零件尺寸测量仪系统。从理论上对机器视觉尺寸检测进行研究,设计适合课题要求、与硬件设备配套使用的视觉检测程序。本课题具体的工作内容包括:
1.机器视觉系统的总体构建与实施方案设计,按照机器视觉系统的结构,分析系统的组成和硬件的参数以及性能,这些硬件包括:光学镜头、光源、CCD相机、图像采集卡,步进电机控制模块,选择各软件模块,完成整个系统的系统设计设计。
2.对图像处理方法进行研究,对常用的图像滤波和边缘检算法进行研究。通过试验比较它们对机械加工零件图像的处理效果,找到适合零件图像的预处理方法。
3.研究基于IMAQ Vision的图像处理函数以及相机的模型和相机标定算法。对本文搭建的机器视觉的相机进行标定,利用标定获得的内参数校正采集到的图像的畸变,提高测量效果。
4.编制软件程序实现图像的采集、图像处理、特征提取和参数计算等功能。
5.分析影像测量仪的精度是否合理。
1.5设计的背景和意义
随着我国经济的持续增长和工业产品精密程度的提高,以及对产品数量和质量要求的提高,传统的尺寸测量手段(如:卡尺、量规、万能工具显微镜、轮廓仪、X射线等)己经不能满足生产的需要。卡尺、量规等检测手段虽然简便、快捷,但测量数据较少、精度不高;万能工具显微镜、轮廓仪等检测手段虽然有较高的精度,但要求在特定的设备、特定的环境下进行检测,不但劳动强度大,效率低,而且检测过程同生产过程是分离的,这与现代工业所要求的在线检测、实时控制的要求不符。机器视觉检测可以高速、可靠和不间断地对工业产品的质量问题进行准确的检测,所以有望能取代以往费时费神但又无法保证检测质量的人工检测方法。基于虚拟仪器的视觉测量系统融合了最新的传感器、电子测量和计算机等技术,使得视觉检测设备具有前所未有的速度、灵活性、测量精度和资源的可重用性。CCD摄像设备的分辨率和成像速度等技术性能的不断提高,数字图像处理技术的逐步完善,以及计算机的性能和性价比的迅速提高,为这一领域的研究提供了相当有利的条件。此外,采用先进的虚拟仪器技术还可以大大缩短产品的开发周期,通过计算机网络可获得丰富的信息亦有助于我们解决各种各样的技术问题。鉴于现在机器视觉在产品测量中应用的现状,本课题针对机器视觉在机械加工零件尺寸检测中的应用进行研究。课题的目标是利用机器视觉在工业检测中的优势对工业产品中基本的直线和圆形特征进行检测。本课题的目标是研究开发基于机器视觉的柔性好、效率高的工件尺寸检测系统。本文的研究对提高我国机器视觉检测系统的开发应用水平,提高工业检测的质量和效率以及突破国外公司对我国机器视觉市场的技术垄断都具有现实意义,所研究的机器视觉系统具有一定的经济价值。
英斯特力仪器是一家集研发、生产及销售于一体的 影像测量仪,拉力试验机, 硬度计 ,探伤仪, 粗糙度仪, 测厚仪, 金相设备厂家, 致力于为客户提供更好的检测仪器。
1.1 Machine vision detection
1.1.1 Machine vision
Machine vision is a science that studies the use of cameras and computers to imitate human eyes and brain to complete tasks such as target recognition, tracking and measurement [11]. As machine vision involves multiple disciplines, it is difficult to give an accurate definition. Machine vision is defined by the Machine Vision branch of the Society of Manufacturing Engineers (SME) and the Automation Vision Branch of the Robotics Industry association of America (RIA) as: "Machine vision is the use of optical devices for contactless perception to automatically acquire and interpret an image of a real scene in order to obtain information or control a machine or process."
People began to study statistical pattern recognition of two-dimensional images in the 1950s, Roberts began to study THREE-DIMENSIONAL machine vision in the 1960s, and Mrr Artificial Intelligence Laboratory formally opened the course machine Vision in the mid-1970s. In the early 1980s, global research boom began, and machine vision gained vigorous development. New concepts and theories keep emerging. With the continuous improvement of computer technology and the increasingly mature image processing and transmission technology, the application of machine vision in production practice has accelerated the pace. Now machine vision has been widely used in industry, agriculture, military, aviation, medicine and other fields. At the same time, machine vision has made great progress in theoretical research. Now machine vision involves many disciplines, including optics, machinery, image processing, computer graphics, pattern recognition, artificial intelligence, artificial neural network and so on.
1.1.2 Machine vision detection technology
With the continuous development of manufacturing industry, the research and application of advanced manufacturing technology are more and more extensive. The popularization and application of advanced manufacturing technology, automatic manufacturing system and advanced production mode require advanced testing methods to adapt to them. Machine vision is applied to the testing field of manufacturing industry, and the process of determining the deviation of products relative to a set of standard requirements with machine vision system is usually called machine vision testing 2. It refers to the application of machine vision in industrial inspection and is an important branch in the field of machine vision application and research. Visual inspection is to be measured, the image as a means of testing and pass information or carrier to take advantage of detection method, the purpose of useful signal is extracted from the image, it is based on the modern optics, image fusion of electronics, computer science, information processing, computer vision and so on science and technology for the integration of modern testing technology. Because machine vision system can quickly obtain a lot of information, and easy to integrate with the design information and processing control information, based on the vision detection technology of the instrument and equipment to achieve intelligence, digitalization, miniaturization, networking and multi-function, with online detection, real-time analysis, real-time control ability, in
Military, industrial, commercial, medical and other fields have been widely concerned and applied [3] [4]. Machine vision inspection usually involves the measurement of the characteristics of specified parts such as accessory integrity, surface integrity and geometric dimensions. The working process of machine vision detection is roughly as follows: First, the camera will be used to convert the target into image signals and send them to a special image processing system, which will process and calculate the information contained in these images; The computer then makes a judgment or decision based on the result of processing; Finally, the control signal is transmitted to the actuator. Machine vision is characterized by automation, objectivity, non-contact and high precision. Compared with general image processing systems, machine vision emphasizes accuracy and speed as well as reliability in the industrial field environment. Compared with traditional manual detection, machine vision detection is more efficient and the detection results are more accurate and reliable. Because machine vision detection will not be affected by the operator's fatigue, sense of responsibility and experience and other factors, in some dangerous occasions not suitable for manual operation, work vision is difficult to meet the requirements of the occasion and with a high degree of repeatability, intelligence and rely on people's eyes can not be continuous and stable product detection occasions, Machine vision can play its own advantages to complete the detection task efficiently and with high quality.
1.2 Virtual Instrument
Virtual Instrument is a brand new achievement which is closely combined with testing technology and Instrument technology in the process of intensive penetration of computer hardware, software and bus technology into other related technical fields [5]. Virtual instrument using IO interface equipment complete signal acquisition and processing, the use of computer display function to simulate the traditional instrument control panel, the output test results with a variety of forms, using computer powerful software implementation evaluation of signal data, analysis and processing, so as to complete a computer instrument system which has the function of the various tests. Virtual instrument is the product of the deep combination of modern computer technology and instrument technology, and it is also an important technology in the field of computer aided testing (CAT). Virtual instrument can make use of the powerful graphics environment and online help function of computer to form a high-grade and cheap new instrument which has both the basic functions of common instruments and special functions that common instruments do not have. It can establish the virtual instrument panel with Chinese and English interface, complete the control, data analysis and display of the instrument, it changes the way of using the traditional instrument, improve the function and efficiency of the instrument, greatly reduce the price of the instrument, the user can define the new function of the instrument according to their own needs. In the virtual instrument system, hardware is only to solve the signal input and output, software is the key of the whole instrument, the structure based on software system can greatly save the development and maintenance cost. The virtual instrument has many varieties, strong functions, high degree of automation and good man-machine interface. Its functions are the same as those of traditional instruments: data collection, data analysis and processing, and data result processing. One of the key differences between them is flexibility. Virtual instruments can be customized by users, which means that users are free to combine computer platforms, hardware, software, and accessories needed to complete applications. This flexibility is not available in traditional vendor-defined, fixed-function instruments. Therefore, virtual instrument is a revolution in the history of instrument development, representing the latest direction and trend of instrument development, and is an important field of information technology, will have a huge effect on the development of science and technology and industrial production, will become the direction and trend of instrument development. 1.3 The development status of machine vision detection in foreign machine vision detection from the beginning of the 1980s has been widely studied, the domestic machine vision detection research from the 1990s gradually began. At present, with the increase of the application of machine vision inspection system, more and more research on machine vision. According to the different application fields of machine vision, the research on machine vision inspection can be divided into different categories, and different scholars have different opinions on classification. Literature [4] divides machine vision quality control systems applied in industry into four categories: dimension quality, surface quality, assembly structure and operation quality. Reference 61 The application fields of machine vision are divided into four categories: product inspection, robotics, product classification and other applications. Dimensional measurement is an important field of machine vision research and application, and it is also a relatively early research direction. When machine vision is applied to dimension measurement engineering, every link from the choice of hardware (light source, image sensor, etc.) of machine vision system to the design of software algorithm will affect the final performance. The proper hardware should be selected according to the characteristics of the project. Literature [7] studied the size detection of electrical disk. Two CCD sensors with 756X581 pixels were used to collect images from the two sides of electrical disk respectively, and the size of the workpiece was obtained through contour tracking, straight line segmentation and sub-pixel positioning. The accuracy of the system reaches plus or minus 0.3 mm, and the detection time of each workpiece is about 0.3 seconds.
Reference [8] studied the piston ring closing 151 clearance measurement system based on computer vision. Using CCD sensor with 795 X595 pixels, the relationship between piston ring parameters is deduced according to the characteristics of piston ring geometry parameters. The sub-pixel positioning technology of the image edge was used to measure the 300 micron opening, and the measurement accuracy of the system was 47 microns.
Reference 9】 The machine vision online measurement system studied measured the range from a dozen threads to the outer contour of 30 mm workpiece. After the experiment, the error of measuring the same workpiece for a long time in the same state reached ±3 microns.
In short, machine vision has great application space in the field of high-precision dimensional measurement. With the maturity of machine vision hardware manufacturing technology and the reduction of hardware cost, machine vision will be more and more widely used in modern production, and its measurement accuracy will gradually improve [10].
1.4 Main contents of the design
On the basis of consulting a large number of domestic and foreign literature design of mechanical parts size measuring instrument system based on virtual instrument and machine vision technology. From the theory of machine vision size detection research, design suitable for the subject requirements, and supporting the use of hardware visual detection program. The specific work content of this project includes:
1. Machine vision system overall construction and implementation of the scheme design, according to the structure of the machine vision system, the analysis and the parameters of the hardware and the system performance, the hardware includes: optical lens, light source, CCD camera, image acquisition card, the stepper motor control module, select each software module, complete the system design of the whole system design.
2. Image processing methods are studied, and common image filtering and edge detection algorithms are studied. By comparing their processing effects on machined parts image, a suitable preprocessing method for parts image is found.
3. The image processing function, camera model and camera calibration algorithm based on IMAQ Vision are studied. To calibrate the machine vision camera built in this paper, the internal parameters obtained from the calibration are used to correct the distortion of the image collected and improve the measurement effect.
4. The software program is designed to realize the functions of image acquisition, image processing, feature extraction and parameter calculation.
5. Analyze whether the accuracy of the image measuring instrument is reasonable.
1.5 Background and significance of the design
With the continuous growth of China's economy and the improvement of the precision of industrial products, as well as the improvement of the requirements for the quantity and quality of products, the traditional measurement methods (such as calipers, gauges, universal tool microscope, profilometer, X-ray, etc.) have been unable to meet the needs of production. Caliper, gauge and other detection methods are simple and fast, but the measurement data is less, the accuracy is not high; Although universal tool microscope, profilometer and other detection methods have higher accuracy, they require detection in specific equipment and specific environment, which not only has high labor intensity and low efficiency, but also separates the detection process from the production process, which is inconsistent with the requirements of online detection and real-time control required by modern industry. Machine vision inspection can be high-speed, reliable and uninterrupted quality problems of industrial products for accurate detection, so it is expected to replace the previous time-consuming and laborious but unable to ensure the quality of the manual detection method. The visual measurement system based on virtual instrument integrates the latest sensor, electronic measurement and computer technology, which makes the visual inspection equipment have unprecedented speed, flexibility, measurement accuracy and resource reuse. The continuous improvement of resolution and imaging speed of CCD camera equipment, the gradual improvement of digital image processing technology, as well as the rapid improvement of computer performance and cost performance, provide quite favorable conditions for the research in this field. In addition, the use of advanced virtual instrument technology can greatly shorten the product development cycle, through the computer network can obtain rich information also helps us to solve a variety of technical problems. In view of the current situation of the application of machine vision in product measurement, this topic is aimed at the application of machine vision in machining parts size detection. The goal of this project is to use the advantages of machine vision in industrial inspection to detect the basic straight and circular features in industrial products. The goal of this topic is to develop a flexible and efficient workpiece size detection system based on machine vision. The research of this paper has practical significance for improving the development and application level of machine vision inspection system in Our country, improving the quality and efficiency of industrial inspection and breaking through the technological monopoly of foreign companies on the machine vision market in our country. The machine vision system studied has certain economic value.