Research on the Visual Processing System of the Punch Press

Most of raw materials of small hardware processing for plate scraps, and it’s realized through the manual operation of ordinary punch, which way has the low production efficiency and the high labor intensity. In order to improve the automation level of production, developing and designing of a visual processing system for punch press manipulator which based on the MFC tools of Visual Studio software platform. Through the image acquisition and image processing, get the information about the board to be processed, such as shape, length, the center of gravity position and pose, and providing relevant parameters for positioning gripping and placing into the punch table positioning of the feeding manipulator and automatic programming of punching machine, so as to realize the automatic operation about press feeding and processing.


Introduction
With China's economic development into the new normal and put forward the strategy of "made in China 2025". As the basis of advanced manufacturing technology and equipment automation, intelligence and information technology, robots play a decisive role in the field of modern production [1][2], one of the important components of the machine vision technology. In the stamping industry of our country, although there have been a large number of CNC(computer numerical control) punch press or modified semi automatic punch for stamping parts manufacturing, But like gaskets, hinges and other small metal parts which is widely used in the production still get through the mode of production such as shown in Fig. 1. If we want to make full use of CNC machine to achieve automatic processing, there are still some problems to be solved: (1)At present, the operation object of punch press manipulator is material waste, as shown in Fig. 2, When the manipulator adsorbent and delivery the board to clamp, easy to cause the clamp clamping effect is not ideal, even holding failure, and then affect the stamping quality.
(2)The existing CNC punch press operation of CAM(the computer-aided manufacturing), the processing plate shape is standard, size is fixed. When the stamping plate is irregular, the work for measuring the plate size will be complex, which is not conducive to the continuity of production.
In view of the above problems, we introduced the machine vision system for industrial manipulator, and give someone install the eyes [3]. Through the image processing program design by MFC(the Microsoft foundation class) with the platform of Visual Studio software, which according to analysis and processing the pixel distribution and brightness information, extraction or calculate sheet shape, length, position of center of gravity and position information, then provide the corresponding data support for operation to the feeding manipulator.

Light source selection
The source which can be used for image acquisition contains: fluorescent lamp, halogen lamp, gas discharge lamp, light emitting diode (LED) and laser diodes (LD).
During design the lighting of the machine vision, we need to according to the performance characteristics of object (metal plate) which work with the machine vision, from the three aspects into account: (1)According to the requirements of the performance of the light source itself, need to consider the contrast, brightness, robustness and so on; (2)According to the requirements of the shape and structure of the light source, need to consider the uniformity of a light source, the light source structure; (3)According to the light source and the required installation location should be considered by means of the irradiation angle, mounting distance and space layout [4][5].
According to the actual conditions, determine the way of lighting with surface light source by back-light illumination, and the space design as shown in Fig. 3, the example image is shown in Fig. 4.

Camera and image acquisition card
Industrial camera is a core component of machine vision, which will directly affect the the image resolution and quality of the collection. The optical lens of CCD camera like as the eye lens of the human, its role is to target aggregation in the CCD array plane, so the performance parameters of the chosen lens, will directly determine the camera can "see" image [6].
According to the features of actual conditions, existing experimental equipment and object detection (irregular sheet), Determined by the German Basler acA2500-14gm industrial CCD camera, and which pixel Depth of is12 and the maximum frame rate is 14. The selected lens is Japan Comutar lens, model is M2514-MP2, which focal length is 25mm, and the aperture is F1.4-F16C. In the meantime, the Image acquisition is the selection of Cognex MVS-8504 PCI card.

Image enhancement and feature extraction
After completing of shooting the board which is putted in the view of the camera, the need for image processing and analysis, including image enhancement and feature extraction. This is a key precondition of obtaining information of the target of the image.

Image enhancement
Due to the object of machine vision is Sheet material leftovers, according to the processing requirements and actual conditions, the image will contain the interference information, which because of the interference of noise, environment of the oil and impurities. Therefore, to remove the noise and weaken the interference information maximum degree by image enhancement, at the same time, ensure the contour of target image be becoming more prominent, in order to carry out post processing work [7].
Median filter is a nonlinear filtering method. It can effectively remove pulse noise interference, and ensure the details clarity of the original image, but someone has some features just like point, line, and spire will loss some relevant characteristics during processing of the image.
The Fig. 4 is the original collected images, Although the median filter can effectively remove the noise and most small spots in the image, and enhance the image edge effect [8], as shown in Fig. 5, could not remove the "burr" on the edge of the image. In order to make the edge clear, it is necessary to sharpen the edge contour by Laplasse.
Laplasse is a kind of method for edge sharpening to enhance the image by using the Laplasse operator, The basic idea is to set up as the Laplasse operator, And after two order partial derivation: The method is get the gradient of the neighborhood in eight directions of the center pixel, and gain the relationship between the center pixel gray and other pixel gray in the neighborhood by summing gradient, and then using the results of the gradient algorithm to adjust the pixel gray image to achieve edge sharpening. The effect of image edge sharpening, as shown in Fig. 6, the red line box in the figure is pointed out that the characteristics of the change point of reference.

Image segmentation
Image segmentation is to separate the image of the target area and the process of extraction, the extracted features can be color, gray and so on, is the key step before image analysis [9].
Through the information of the histogram image determine image gray distribution information, and selecting one or more threshold T, the gray level of the image will be divided into several parts, and thus make the same gray value range of image distinguish with other parts, or make the non target area direct to backgrounding. So this method is especially suitable for the images with different targets and backgrounds.
In order to ensure the image segmentation effect, In order to ensure that the segmentation threshold is not distribution due to the difference of the gray level, the iterative method is used to determine the optimal segmentation threshold, which can get better image segmentation results.

Edge and Contour extraction
The edge is a set of connected pixels that make the pixel gray scale produce a step change or a change of the roof. The Edge extraction is the process of extracting the intersection line between the fore-ground and the background in the image by some operators. Contour extraction is a process to obtain the process of sheet metal contour information by extracting the edge of the detected edge. By the previous work of threshold segmentation, the realization of the image of the two value of processing, so that the image only composed of the pixels which gray values only are 0 or 255 (black and white). In this paper, the shadow difference method is used to extract the contour, and the realization method is: gets the pixel value of a point A in the image Z A = 255, as shown in Fig. 7, make a judgment for all of the 8 points in the neighborhood of the gray value, if every point Z i != 255, then the pixel value Z i is set to 0 in the 3 × 3 region, so that the area of whitening; while the pixel value of the 8 points of the neighborhood is not all 255, the point will be set as the boundary point, and the pixel value of the pixel is preserved. In the end, the Fig. 8 will be converted to Fig. 9, and the red line box in the figure points out the main change characteristic reference point.

Image feature extraction
Edge and contour extraction is the original description of the segmentation results, which contains the parts that do not need, which needs to determine one or more features from the area or profile [10]. The characteristic of this paper is the best fitting line of the edge of the plate. Currently widely used line detection method mainly has the least square method and Hough transform method. Because the least square method is not easy to have multiple line segments to form a closed contour line extraction, So using the Hough transform method as the selection.
According to the general principle of line detection of Hough transform, there are many lines in the extracted edge contour, that corresponds to a plurality of (r,θ) points in space, each line is composed of a large number of consecutive pixels, and reflected in the space that corresponds to the number of sine curve through the point (r i , θ i ), therefore, through the largest number of sine curve group on the composition (x, y) space in the best straight line. When a curve in (r, θ) space is also a common point, the point will be a intersection of two straight lines in (x, y) space. The specific implementation process of Hough transform to detect straight line is as follows: (1)Initialize a array in the transform domain (r, θ) space and the number in the r direction is the number of pixels in the diagonal direction of the image, The number in the θ direction is defined as 90 (angle from 0~180, interval is 2 degrees).
(2)Search the map of all black spots, each black spot in the transform domain of the corresponding points on the plus 1; (3)Find the maximum points in the transform domain and record, in the meantime, cleared all of points near the maximum point; (4)According to the requirements and finding out multiple maximum points in the image in turn; (5)Draw the straight line drawn from all the points of the maximum value, and there is the intersection of the two straight lines.
Which added a zero function in the c step, and the realization of the function: after extracting the best approximation linear will be clear of the image contour and make straight contour clear, reduce post size measurement of interference. Fig. 10 is the detection results with traditional Hough transform linear, Fig. 11 is the improved linear extraction effect, as shown below: Figure 10. The effect before Improvement Figure 11. The effect after Improvement

Dimensional measurement and Display
Dimensional measurement is one of the most common techniques used in machine vision technology, including the length, angle, aperture, diameter, area and other geometric parameters of the object. In this paper, the extraction of target parameters including plate area, length and angle.
Pixel is the basic unit of image composition, but also as a representation of the size of the image unit. The image resolution is a unit of the number of points on the length and width of the image, and the size is equal to the product of the number of pixels in the length and width direction. So when the camera's resolution is determined, the area of the image is also determined. When the space position of the camera and the tested plate are fixed, there existed the ratio K between the measured plate length L and the number of pixels N pixel corresponding to the edge in the image, that is L=K N pixel . The K value can be obtained by calibrating the calibration board, such as the calibration board to take the length of a fixed point is l, the standard fixed point in the image corresponding to the number of pixels is P, then the ratio coefficient K=l/P.
In order to obtain pixels number in each side of the image, on the basis of reference to the relevant methods of current corner detection, using Moravec corner detection algorithm related ideas to extract the linear intersection point of each edge. The main ideas are as follows: (1)Firstly, the gray value of each pixel in the image is retrieved one by one. And set a local window which size is 3x3. If the detected pixel is white, the other 8 points of values within the window are judged, and recorded as the number of white spots; (2)Judge the number of white spots, if count != 5, count cleared, and if count == 5, put the coordinates value of the point into the corresponding array; (3)At the same time, clear those adjacent pixels which have meet above conditions. The final extracted corners are marked with a, b, c, d, and the coordinates of each corner point are displayed.
By calculating the distance between the adjacent nodes, the length of each edge is calculated. In order to be advantageous to output the dimension parameter After the above algorithm we can obtain the coordinates values of polygon corner, then get the number of pixels which contained in the line between two corners. After obtaining the coordinates of each corner, the angle value specified in the image can be obtained through the included angle of the two straight line slope, and the area of the measured object can be obtained.
Through calculating the distance between the two points, select the maximum edge length. By the above definition of point a, b, c, d can be known, which are marked in a clockwise direction. Because the shape and the angle of the four edges are random, the maximum side may appear on any edge of a, b, c, d. At the same time, according to the material requirements, after the plate is grabbed by the robot hand, should put the maximum edge on the clamp, and make sure that the whole plate is on the punch table. Therefore, it is necessary to adjust the angle of the detected angle to output the effective adjustment angle. In order to deal with all kinds of situations, decide that measure the angle between the maximum edge and the I axis by the method of piece wise analysis, that is analysis each line segment, for example the line segment ab is the longest side, and calculate the angle between the long side and the I axis. The algorithm flow of the design is shown in Fig. 12

Conclusions
Through the image processing and analysis for the realtime collected images, then obtain the information of plates, include contour shape, length, position and posture, which are waiting for processing, and provide real-time and accurate data support for the motion control of the automatic feeding of the robot and automatic generation of CAM machining program for punching machine.