A method for extracting elbow feature based on machine vision

With the continuous development of computer technology, machine vision has become a hot research topic. And the machine vision is introduced into the field of mechanical processing, the detection of the surface defects of the machined objects. The application of machine vision to industrial production has become more and more popular. The research content of this paper will have broad prospects and development space in the field of machine vision. It has laid a foundation for solving the problems of manual processing, and plays a very important role in the development of universal CNC system with vision.


Introduction
This paper mainly introduces the application of machine vision in the feature extraction of elbow. Taking elbow characteristics as an example, put forward the theory and the improved method of image feature extraction, and gives the design scheme of the whole system of feature extraction. This paper mainly includes three aspects: Firstly, design of the overall system scheme based on machine vision; Secondly, propose an improved algorithm based on Canny operator, by comparing the detection results of several commonly used image detection operators, based on the OpenCV; Thirdly, take sample of the outside of the elbow by MATLAB, and use the least square method for curve fitting. Then calculate the curve function and the radius of characteristic parameters of the elbow.

The design of the elbow feature extraction system
A typical machine vision system includes a light source, an optical system, an image acquisition system, a digital image processing, an intelligent decision making module and a mechanical control execution module. The system includes four parts: vision sensor, high speed image acquisition system, special image acquisition system and PC computer. First of all, the target is converted into an image signal by a vision sensor CCD camera; Next, the digital signal is transmitted to the special image processing system, according to the information of the pixel distribution, brightness and colour; And then, perform various operations to extract the features of the target, judge the result according to the present tolerance and other conditions. Finally, according to the results of the judge to control the equipment movement [2].
The main principle of this system: The image capture system work site (several CCD) and image acquisition system (image acquisition card) to collect the image data of elbow，then the data are sent to PC in the program calls for processing by the image acquisition card, image geometric correction, image enhancement, image smoothing, image segmentation, edge detection and other operations on the work piece prepared using VS algorithm, obtain the characteristic parameters of elbow by curve fitting using MATLAB least squares method [3].

The optimization algorithm of edge detection based on Canny
The edge is the most significant part of the local brightness of the image. The edge mainly exists in the target and target, target and background, region and region (including different colours). For a work piece, the main feature is the angle of the edge contour. Therefore, edge detection is very important for object recognition, which is an important part of image processing. Poggio has such a definition that the edge detection is the measurement, detection and location of the gray level of the image. The essence of edge detection is to use some algorithm to extract the line between image and background. In general, work piece edge angle can be divided into four types: line-line type, line-arc, arc-arc and arc-line type. When the line is arc tangent, the cross point between the two is the cut off point, the connection point between the convex and concave arc is the inflection point. Detection of target edge angle is mostly based on the change of edge curvature, the discrete curvature is estimated by the change rate of tangent direction, and the vertex with high curvature is considered as the vertex.
[4]Now, the widely used method to extract edge feature parameters is the edge detection algorithm based on curvature (edge detection algorithm).
The commonly used operators include Roberts operator, Sobel operator, Laplacian operator, etc. Each operator has its advantages and disadvantages: The Roberts operator has high positioning accuracy, good effect in horizontal and vertical direction, but it is too sensitive to noise; The Sobel operator can produce better results, it has a smoothing effect on noise and can provide the edge direction information accurately, but it also increases the amount of calculation, and will detect the false edge, even the position of image is not accurate; The advantages of the Laplacian operator is that it does not have false edges and always used for known edge pixels to determine the image in the dark or light, but it is sensitive to noise. The edge detection algorithm uses the change rate of tangent direction to estimate the discrete curvature and the vertex with high curvature is considered as the vertex. But the main defect of this algorithm is that the detection method based on edge curvature can not judge the tangent point and inflection point of this kind of common feature points in a work piece, due to its smaller curvature. When the target is rotated toward the edge of a different direction, it will be error detection because of the digital image in discrete curvature measuring is not stable. Compared with the traditional image edge detection methods, this paper uses Canny operator to detect edges [5]. The canny operator first proposed three continuous criteria of edge detection: optimal detection result, 3 1234567890 optimal location and low repetition response. Its basic idea is to use the Gauss function Gauss to smooth the image, and then determine the edge points by the maximum value of the first order differential. The zero crossing of the two order differential not only corresponds to the maximum of the first derivative, but also corresponds to the minimum value of the first derivative. In other words, the image gray change and slow change point corresponds to two derivative zero crossing point. Consequently, the Canny operator may introduce pseudo edge points Chalk up ( , ) · ( , ) after filtering by Gauss function, and α of them are the corresponding scale factors. The gradient vector model and the direction : The edge of the image is a point in the direction that makes the get the local maximum.

The curve fitting of elbow
In the experiment and statistical research, it is often necessary to estimate the function of the = ( ) approximation function ( ) from a set of measurement data of ( , )( = 0,1,2, … , ) [6]. Interpolation is a way to deal with such problems, but it has obvious flaws. First of all, it is necessary to approximate all the known points of the function ( ) which is equivalent to the total error, because of the inevitable errors in the observed experimental data and even larger errors. In addition, if still use polynomial interpolation, it will inevitably get a higher number of polynomials because the experimental data are often too much. Not only the calculation is complex, but also the convergence and stability of ( ) are difficult to be guaranteed, so the approximation effect is poor. In order to overcome these shortcomings, often adopts the method of curve fitting for data processing. The curve fitting is to find out the general rules from the data sets of ( , )( = 0,1,2, … , ), and construct a curve which can reflect this rule of ( ). It does not require the curve of ( ) across each data point of ( , )( = 0,1,2, … , ), but the curve can be as close as possible to all data points, that is, all errors of = ( ) − ( = 0,1,2, … , ) achieve the minimum according to a certain standard [7]. Generally use the following three standards to measure the size of the error: Because there is no absolute value of 2-norm and the calculation is more convenient, it usually adopts 2-norm square as a measure of the total error. We called it is least squares curve fitting which Can make 2-norm minimum square.
In fact, it is a vector of coefficients which is a polynomial when using the least square method to fit the curve. In MATLAB, using the function of polyfit to obtain the least squares fitting polynomial coefficient, and according to the given function to calculate the polynomial point approximation by the function of polyval. The function of the polyfit call format [8]: [ , ] = ( , , ). According to the sampling point X and the value of sampling point function of Y, Produces a m degree polynomial of P and its error vector of S at the sampling point. Among them, X and Y are the vectors of the same length, P is a vector with the magnitude of m+1, the elements of P are the coefficients of the polynomial. In this paper, use MATALAB to sample the inner side of the elbow image and use the least square fitting method to fit the image , because of the bending radius determined by the radius of curvature.