#### Abstract

Flexible workpiece includes the materials 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.38 ms.

#### 1. 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. 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. 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.

#### 2. 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-arc-angle , 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.*Straight-Straight-Angle ** of Figure *1. , are the processing trajectory fitting straight lines , after the extraction of profile is the angle between the two straight lines, , , and , , and are constants; formula (1) can be obtained by the linear equation of , :
*Arc-Arc-Angle ** of Figure *2. is the intersection point of two extracted fitting arcs trajectory , ; arc-arc-angle is formed by tangents , of circle P1, P2, , , , and , , are the geometric equation coefficients of circle P1, P2; formula (2) can be obtained by the tangents equation of , :
*Straight Line-Arc-Angle ** of Figure *3. straight line-arc-angle is formed by fitting straight line of straight line trajectory and the tangent of fitting arc of arc trajectory. , , and are constants, , , and are the geometric equation coefficients of circle P1, and formula (3) can be obtained by straight line and tangent equation :
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.

#### 3. 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].

##### 3.1. 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 ~ (, 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 of the image, if the modulus value is a local maxima along given gradient direction of the argument , 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.

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 appears in the place where ; that is,

Then, the extrema ratio of two different scale factors , (), can be obtained as formula (9).

Therefore, corner detection procedure of processing trajectory image is expressed as follows. Extract the edge profile of processing image trajectory based on wavelet edge rapid extraction algorithm. Calculate the wavelet transform of in the three adjacent scales , , and , and the result is stored in the specified array. Detect the extremum in three adjacent scales of , if there is wavelet extrema in each corresponding position of the three adjacent scales and its value is not less than the set value , the corner is a candidate one. Calculate the extrema ratio of two different scale factors while , , or , , if (, ), the corner is a candidate one, otherwise, forgone the corner:

##### 3.2. Hardware Implementation of Processing Image Wavelet Transform of FIR Filter Accelerating Decomposition/Reconstruction

Let be the flexible workpiece trajectory processing image. reflects low-frequency components in both the horizontal direction () and vertical direction () after conducting the two-dimensional wavelet transform of processing image, reflects the low-frequency components in direction and high-frequency components in direction , and reflects the high-frequency components in direction and low-frequency components in direction , reflects high-frequency in both directions , [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 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–14].

Based on Figure 9, choose Daubechies as the filter of wavelet decomposition and reconstruction procedure of ; 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.

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. Response of Daubechies filter coefficients 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. 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 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), configuration register coefficient (CONFIG), and start filter (EXEC) three states. The switch of each state is controlled by the two signals FSL_S_ Exists and FSL_S_ Control of FSL interface. Figure 9 is an 8-tap FIR filter FSL control state machine.

#### 4. Testing Laboratory

Figure 10 is physical photo of the Xilinx FPGA IP core verification platform. Experimental hardware environment is Computer PC, Intel Core i5 processor, the operating frequency 2.19 GHz, memory 2 GB, Xilinx VC4VSX25 FPGA development system; software environment is Microsoft Windows XP Professional operating system, Xilinx ISE10.1i EDK 10.1i Modelsim6.5, MATLAB R2008a. To establish IP core verification project by using Xilinx Platform Studio (XPS), the frequency of MicroBlaze Processor processor is 165 Mhz and PLB bus clock cycle is 1 × 10^{5} ms. Processing trajectory image (grayscale image) of Figure 11 is taken as test picture, with the size of 720 × 576 pixels; Daubechies filter is choose as wavelet transform [11].

##### 4.1. FIR Hardware Implementation Test of the Processing Image Wavelet Transform

Conduct a two-stage wavelet decomposition on trajectory processing test image, with each stage including the horizontal and vertical direction wavelet decomposition, image decomposition effect, and wavelet decomposition time of each stage.

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 high-frequency 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).

**(a) The first stage**

**(b) The second stage**

**(a) The first stage**

**(b) The second stage**

From Figures 12 and 13, we can know that frequency components of the first and second level decomposition relative to wavelet decomposition result of 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.

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 , , and the total consuming time , and make a comparation with consuming time of computer PC. The total consuming time of two levels wavelet decomposition calculated by hardware in Table 1 is ms which is 5.561% longer than ms the calculated time of PC.

##### 4.2. The Angle Measurement Laboratory of Processing Trajectory

Let , , , = 0.95, and = 1, put them into formula (6), and make a search for the corner in specified region of processing trajectory image which is shown in Figure 15 (arc primitive , ), 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 , . In order to make a further test of angles , , firstly take 12 fitting points of each arc , and search outwardly with the length of 20 pixels, finally the fitting circles , can be got. Combining with calculation formula (2) of arc-arc angle, the angle of arc primitive , 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.

#### 5. 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 and reconfigurable computing IP core; total consuming time of the two level hardware core wavelet decomposition is only 5.561% longer than the calculated time of PC.

#### Acknowledgments

This work is partially supported by National Natural Science Foundation of China (no. 51205069), Natural Science Foundation of Guangdong Province, China (no. S2013010013288), and Combination Project of Industry-university research of Huizhou city of Guangdong Province China (2011C010002008).