Study and Testing of Processing Trajectory Measurement Method of Flexible Workpiece

Flexible workpiece includes thematerials like elasticity spline, textile fabric, and polyurethane sponge, due to the fact that processing trajectory is composed by small arc or small line segment primitives and the deformation of the flexible workpiece during the processing trajectory, making the captured image of processing trajectory not clear, the edge of processing image over local uneven gray, and also the pixels of boundaries between the processing trajectory image edge and background organizations not obvious. This paper takes corner search of processing trajectory as the cut-in-point, slope angle curve of starting and terminal point of each primitive is also designed, put forward the search algorithm that regards Daubechies (4) as wavelet operator to conduct slope angle curve for multiple scales wavelet transform, by judging whether there is a point of the curve appears wavelet transform extremum to determine whether the point is a corner point based on wavelet edge modulus maxima extract principle. Finally, proposed a decomposition/reconstruction design method of FIR filters based on wavelet transform of processing image. Eight-tap transpose FIR filter is used to design the decomposition of Daubechies (4) and reconfigurable computing IP core. The IP core wavelet decomposition of the total time-consuming increases only 5.561% in comparsion with PC. Trajectory angle relative error is 2.2%, and the average measurement time is 212.38ms.


Introduction
Flexible workpiece trajectory processing refers to the procedure of conducting all kinds of complicated image processing in workpiece which is consisted of multilayer soft material, and emerged some uneven pattern on the surface of workpiece [1,2].Straightness, roundness, and primitives angle error geometrical are the important measurement parameters of machining profile of flexible workpiece trajectory processing which is an important indicator of evaluating the trajectory processing precision, also providing a basis for the processing feedback compensation control [3].However, the edge and corner of the pattern of flexible workpiece processing trajectory are fuzzy and shaped; the extraction of processing image feature information (such as edges, corners and shapes) is a key issue in processing trajectory visual measure method.At present, there are two main kinds of fuzzy edge detection algorithms: Pal fuzzy edge detection algorithm and multiresolution image detection algorithm.Pal and King put forward the Pal fuzzy edge detection algorithm that the awaiting image is mapped into fuzzy membership matrix; maximum and minimum operator are used to extract edge [4] from the viewpoint that the uncertainty of the image is caused by the fuzziness, while Shi Chengxiang puts forward the extended multiscale fuzzy edge detection algorithm that extends 8 neighborhood to 16 of gray, making a merger of wavelet multiscale and fuzzy theory and using competition rules to select the edge points from the viewpoint that the image pixel of the edges changes in different neighborhoods gray [5].Literature [6] puts forward an error compensation method that consists of an element-free error interpolation scheme and a recursive software error compensation scheme.Literature [7] proposes a density-based clustering algorithm for trajectory data stream.
Flexible workpiece includes the materials like elasticity spline, textile fabric, and polyurethane sponge; its material mode shows the physics nonlinearity or geometry nonlinearity, macroscopic property respond to low rigidity intensity, low elasticity modulus, soft mechanics property, and so on.
The processing trajectory discussed in this paper refers to processing completion in flexible workpiece, with the following characteristics.(1) The deformation is generated by extruding during the process of flexible workpiece trajectory processing; there is a certain lag about elastic recovery of workpiece after processing, it will make the captured image not clear especially the edges of the image over local gray uneven near the trajectory.(2) Due to the fact that processing trajectory is composed by small arc or small line segment primitives and the diversity of geometry, the pixels of boundaries between the processing trajectory image and background organizations are not obvious in the convergence department of small arc and small line segment.Thinking about the edge blur and diversity of geometry of flexible workpiece processing trajectory pattern, the edge detection based on multiscale fuzzy and rapid positioning of the image corner is the key to accurately measure trajectory profile.This paper focuses on the measurement of the angle error due to the fact that the processing angle error can evaluate processing effects of right, sharp angle and line or arc which are the composition of the angle and can be easily measured online.

Mathematical Description and Measurement Ideas of Flexible Workpiece Processing Trajectory Angle
The trajectory straightness error   , angle error   , and roundness error   all can reflect the deviation of trajectory, owing to the fact that the angle error   can evaluate the integration processing effects of right angles, sharp corners, and the included angle which consists of straight lines or arcs, and the angle error   can measure online easily, so the paper focuses on the method of flexible workpiece trajectory processing distortion compensation control with angle error   that can measure feedback.Processing trajectory is composed by small arc or small line segment primitives; Figures 1 to 3 are the three types of processing trajectory element angle (including straight line-straight line-angle  - , arc-arcangle  - , and straight line-arc-angle  - ).From Figures 1 to 3 we can know that the angle of the handover of lines and line segments is easy to obtain; as for seeking the angle of handover of arc and line segment (or arc), we must firstly seek the arc tangent, and then the angle between tangent and line segment; therefore, the actual angle can be found by correctly extracting line segment, arc profile of processing trajectory.
( . ( ) . ( ) . ( Figure 4 is the flow chart of processing trajectory angle measurement.The processing is composed by the following parts.Firstly, PAL analog camera collects and processes image video information; the information enters into image sensor signal acquisition module after it converted to digital video through decoder chip TVP5150.Secondly, conduct wavelet transform of processing image, thirdly, extract processing trajectory profile.Finally, locate the origin and terminal of primitive, and calculate the angle of primitives.

Angle Measurement and Implementation of Flexible Workpiece Processing Trajectory Base on Wavelet Multiscale
Angle measurement of flexible workpiece processing trajectory is based on the wavelet decomposition of processing image; measure angle can be obtained by extracting processing trajectory profile, determining corner of each trajectory primitive (the start and terminal position of primitive), and drawing out the angle measurement auxiliary line.Since the processing trajectory profile can be extracted through wavelet modulus maxima [8,9], in the following content, the positioning algorithm of starting, terminal points position will be discussed combining the information processing of wavelet multiscale [10].

Corner Multiscale Wavelet Positioning Algorithm of the
Flexible Workpiece Processing Trajectory.For closed processing trajectory of geometric patterns, the place where starting, terminal points of primitive located is also the place of each corner in the trajectory; they are in the greater curvature of the trajectory image profile.As Figure 5 shows, the curve () −  can be obtained by obtaining the slope angle () of each point  along the processing trajectory profile, and the corner region of each corner shows a step change on the curve; the sharper the corner is, the greater the step amplitude will be.If the adjacent angle curves () are not overlapped, the corner of the corner point is in the range of { −  ∼  + } ( ≤ 3, and is an integer), the slope is represented by , the constant is represented by , and assuming its curve () −  is monotonic rise (or fall), in that way, the curve can be seen as Figure 6 shows, a monotonic rise curve composed by three lines; the curve equation is shown as follows: According to extraction algorithm of wavelet edge modulus maxima, at an arbitrary point ( 1 ,  2 ) of the image, if the modulus value   ( 1 ,  2 ) is a local maxima along given gradient direction of the argument   ( 1 ,  2 ), it is considered as the proof of an edge point [9,10]; the curve () −  can be conducted multiple scales wavelet transform and by judging whether a point of the curve appears wavelet transform extrema to determine whether that point is a corner one.x 1(p−q) x 1(p+q) x 1p x 1 (p) Let  be the scale factor, cubic spline is smooth function (), and   () is the first derivative of (), let   () be the basic wavelet; therefore, () conducts wavelet transform on (): It can be seen that extremum of WT  (, ) appears in the place where  = 0; that is, Then, the extrema ratio of two different scale factors  1 ,  2 ( 1 <  2 ), can be obtained as formula (9).
Therefore, corner detection procedure of processing trajectory image is expressed as follows.(1) Extract the edge profile of processing image trajectory based on wavelet edge rapid extraction algorithm.(2) Calculate the wavelet transform WT  (, ) of () in the three adjacent scales  = 2 −1 , 2 −2 , and 2 −3 , and the result is stored in the specified array.

Hardware Implementation of Processing Image Wavelet
Transform of FIR Filter Accelerating Decomposition/Reconstruction.Let ( 1 ,  2 ) be the flexible workpiece trajectory processing image. 1 ( 1 ,  2 ) reflects low-frequency components in both the horizontal direction ( 1 ) and vertical direction ( 2 ) after conducting the two-dimensional wavelet transform of processing image,  1 (1) ( 1 ,  2 ) reflects the lowfrequency components in direction  1 and high-frequency components in direction  2 , and  1 (2) ( 1 ,  2 ) reflects the high-frequency components in direction  1 and low-frequency components in direction  2 ,  1 (3) ( 1 ,  2 ) reflects high-frequency in both directions  1 ,  2 [11];  represents the low-pass filter having the impulse response and  represents the high-pass filter having the impulse response, according to Mallat algorithm, wavelet decomposition, or reconstruction of ( 1 ,  2 ) is consisted of several levels high-pass filter  and low-pass filter , ,  can be built by using finite length (FIR) filter as Figure 7 shows when the filter coefficients is known [12][13][14].
Based on Figure 9, choose Daubechies (4) as the filter of wavelet decomposition and reconstruction procedure of ( 1 ,  2 ); since the wavelet filter coefficients are eight, each ,  filter can be built by 8 gap FIR filter.
Figure 8 is the structure of FIR filter based on Xilinx VC4VSX25 FPGA and DSP48 Slice of Xilinx Xtreme DSP.
(1) Configure port OPMODE = 0000101 of the left first DSP48 slice in the figure while other OPMODE = 0010101, port  of all levels are the input terminal of image signal [], expressing it in complement; data width is 18 bits, including 1 sign bit, 9 integer bits and 8 decimal bits.(2) Response of Daubechies (4) filter coefficients Coef() of each level is stored in register , expressing it in complement; data width is 18 bits, including 1 sign bit and 17 decimal bits.By connecting port BCIN, BCOUT of all levels of register  to form a register chain, it can easily modify the entire filter coefficients of all levels by operating port  of the first level DSP48.(3) The input CIN and output COUT of processing results at all levels interconnect; the final result [] is output through port , with the width 48 bits.As for the input of 8-bit image pixel, the data is first shifted to the left by 8 and then input; finally output intercept high 32 bits (4) 8-tap FIR filter is connected to VC4VSX25 FPGA embedded Microblaze Processor in coprocessing way, performing data communication through interface of fast single-link bus FSB bus and control logic state machine is consisted of awaiting image data input (IDLE),    11 is taken as test picture, with the size of 720 × 576 pixels; Daubechies (4) filter is choose as wavelet transform [11].(1) Wavelet decomposition of processing image is divided into 2 levels: the first level of decomposition includes 2 stages; the first stage is the wavelet transform in vertical direction, and in this stage, the low-frequency component is in the upper half part of the image, while high-frequency component is in the below half part; the decomposition results can be seen in Figure 12(a).The second stage is the wavelet transform in horizontal direction; in this stage, the low-frequency component is in the left half part of the image, while highfrequency component is in the right half part; the decomposition results can be seen in Figure 12(b).The second level decomposition also includes 2 stages; the first stage is the wavelet transform in horizontal direction, and in this stage, the low-frequency component is in the left half part of the image, while high-frequency component is in the right half part; the decomposition results can be seen in Figure 13(a).The second stage is the wavelet transform in vertical direction; in this stage, the low-frequency component is in the left half part of the image, while high-frequency component is in the right half part; the decomposition results can be seen in Figure 13(b).

Testing Laboratory
From Figures 12 and 13, we can know that frequency components of the first and second level decomposition relative to wavelet decomposition result of ( 1 ,  2 ) given in Section 3.2.
Figure 14 is the processing image after conducting wavelet transform reconstruction; the image is nearly the same with original drawing in Figure 11, proving that the correctness of designing processing image wavelet transform of FIR filter for image decomposition and reconstruction.
(2) In the condition that PLB bus clock cycle is 1 × 10 5 ms, make a test of 11 times about the time required to FIR filter wavelet decomposition, respectively, statistic the consuming time of two levels wavelet decomposition  wmrt c1 ,  wmrt c2 , and the total consuming time  wmrt , and make a comparation with consuming time  wmrt pc of computer PC.The total consuming       which is shown in Figure 15 (arc primitive  1 ,  2 ), and Figure 16 shows that the testing results of origin and terminal location.
It can be seen that algorithm can accurately locate the position of the corner, the position where the starting, terminal points are of arc primitive  1 ,  2 .In order to make a further test of angles  1 ,  2 , firstly take 12 fitting points of each arc  1 ,  2 and search outwardly with the length of 20 pixels, finally the fitting circles  1 ,  2 can be got.Combining with calculation formula (2) of arc-arc angle, the angle of arc primitive  1 ,  2 can be calculated (see Figure 17).Table 2 is the comparison table of measured value resulting from repeating 10 times measurements and actual value; the average relative error of measurement method is 2.2% and the average measured time is 212.38 ms.

Conclusions
(1) According to the fact that processing trajectory is composed by small arc or small line segment primitives and the pixels of boundaries between the processing trajectory image and study a search algorithm of origin and terminal location combined with wavelet multiscal algorithm, the results show that relative error and average measure time of trajectory angle is 2.2% and 212.38 ms.
(2) FIR filters accelerated decomposition/reconstruction design method of processing image wavelet transform is put forward.Eight-tap transpose FIR filter is used to design the decomposition of Daubechies (4) and reconfigurable computing IP core; total consuming time  wmrt of the two level hardware core wavelet decomposition is only 5.561% longer than  wmrt pc the calculated time of PC.

( 3 )
Straight Line-Arc-Angle  - of Figure 3. straight linearc-angle  - is formed by fitting straight line  1 of straight line trajectory and the tangent  2 of fitting arc  1 of arc trajectory. 1 ,  1 , and  1 are constants,  1 ,  1 , and  1 are the geometric equation coefficients of circle P1, and formula (3) can be obtained by straight line  1 and tangent equation  2 :

Figure 4 :
Figure 4: Flow chart of processing trajectory angle measurement.

Figure 7 :Figure 8 :
Figure 7: Structure of FIR filter with the length .

Figure 11 :
Figure 11: Test picture of flexible workpiece trajectory processing.

Figure 12 :Figure 13 :
Figure 12: Decomposition result of the first level wavelet transform.

Table 2 :
Comparison table of angle measurement.