A kind of precision measurement method of static cutter image
Technical field
The invention belongs to electronic measuring technology field, it is particularly related to the technology that digital picture detects.
Background technology
In Digit Control Machine Tool and machining center, in order to reduce nonproductive time, improve working (machining) efficiency, need carry out accurate measurement to cutter.Conventional method adopts the hand dipping of human eye aiming mostly, and this method is very consuming time, and certainty of measurement is low, and measurement result is subjected to the subjective factor influence easily.
Measuring method based on image processing techniques has appearred in recent years, i.e. the image measurement method.It is meant the tool setting image that utilizes ccd image sensor picked-up cutter, is transferred in the computer, through the digital picture algorithm process, obtains the measurement result of tool geometrical parameter.Its key technology is the extracting method and the edge accurate positioning method of contour feature point respectively.The former typical method is based on the feature point detection method of transform domain, such as, respectively problem is converted to the differentiation of asking parameter field extreme-value problem or one group of small echo descriptor etc. based on the Hough conversion and based on method of wavelet, though the transform domain method may make problem obtain simplifying, but before and after conversion, often need a large amount of extra time and memory spaces, so practicality is relatively poor; The latter is divided into traditional edge localization method and sub-pixel edge localization method, traditional edge detection algorithm such as Roberts operator and Sobel operator, can only reach 1-2 pixel to the Image Edge-Detection precision, the amount of calculation of typical sub-pixel edge localization method such as fitting process is too big, responsive to noise, and the accuracy of gray scale square edge detection algorithm is relatively poor.
Summary of the invention
The object of the present invention is to provide a kind of precision measurement method of static cutter image, adopt method of the present invention can from single width cutter image obtain easily having than high measurement accuracy tool geometrical parameter.
For describing the present invention easily, at first image is handled term definition:
Gray level image is meant the image of being made up of 256 kinds of greyscale color;
Bianry image is meant the image of being made up of two kinds of colors of black and white;
Morphologic filtering is handled and is meant the opening and closing operation of image being carried out morphological image, realizes the effect of image filtering;
The morphology gradient is handled and to be meant image is made morphologic corrosion or dilation transformation, and image after the conversion and original image subtract each other and obtain gradient image;
The morphology thinning processing is meant makes morphological transformation to image, makes the image border width be reduced to a pixel;
Morphology pruning processing is meant makes morphological transformation to image, and the burr on the removal of images edge makes the image border Paint Gloss;
After the sub-pixel edge point is meant that image is handled through the sub-pixel edge localization method, the exact position of the picture point of straightway and arc section on the image outline that obtains.
The invention provides a kind of precision measurement method of static cutter image, it is characterized in that adopting following step:
The cutter coloured image that step 1:CCD camera collects is transferred in the computer, converts thereof into gray level image, converts it into bianry image simultaneously, as shown in Figure 4;
Step 2: to the cutter bianry image that step 1 obtains, utilize the morphological image operator to do morphologic filtering, morphology gradient, refinement, a series of processing of pruning, can obtain the bianry image edge of cutter, shown in Fig. 5 (a);
Step 3: at first the cutter bianry image edge that step 2 is obtained is followed the tracks of, obtain cutter image outline data, utilize the least square fitting contour curve again, determine the characteristic point (angle point, point of contact) of cutter image outline in conjunction with slope and curvature information, and cutter image outline curve is done segmentation discern, as Fig. 5 (b) with (c);
Step 4: the cutter gray level image that step 1 obtains is done the sub-pixel edge location.
The sub-pixel edge localization method is divided into 3 steps:
At first, be the center with current point, determine a rectangular area, respectively in the zone longitudinally data make least square fitting, the data that obtain revising by the curvilinear function after the match;
Then, data are done horizontal B spline-fit respectively in the revised rectangular area that previous step is obtained, and obtain the curvilinear function after the match;
At last,, ask for the first derivative of curvilinear function, determine the sub-pixel edge value of cutter image, the exact position of the picture point of straightway and arc section on the image outline that promptly obtains at the first derivative maximum according to the curvilinear function after the match;
Step 5: the sub-pixel edge value of the cutter image that step 4 is obtained (being the exact position of the picture point of straightway and arc section on the cutter image outline), adopt the tool geometrical parameter measuring method just can obtain high-precision tool geometrical parameter: length, angle, radius.
Described tool geometrical parameter measuring method is:
When (1) measuring length, as shown in Figure 6, utilize step 4 to determine n sub-pixel edge point respectively on cutter image border both sides AB, CD, utilize least square fitting to go out the linear equation of AB, CD again, the last i point of AB can calculate d by the distance between beeline and dot formula to the distance of CD
i, calculate average distance then
When (2) taking measurement of an angle, as shown in Figure 7, at first utilize step 4 to determine respectively sub-pixel edge point on the straight line of both sides to utilize least square fitting to go out the both sides linear equation again on the straight line of angle both sides, calculating angle θ between the straight line of both sides according to the slope meter of both sides straight line at last;
When (3) measuring radius, as shown in Figure 3, adopt center of circle method to measure;
Described center of circle method is meant the center of circle of obtaining cutter image arc section earlier, utilizes the center of circle to try to achieve radius to the distance of circular arc tangential line again, and its concrete steps are as follows:
(a) utilize step 4 to determine the sub-pixel edge point of circular arc both sides tangent line respectively, utilize least square fitting to go out the tangential equation of circular arc both sides, tangent line ME, NF are prolonged the D that intersects at a point, on their angular bisector DK, search for the center of circle;
(b) on angular bisector DK, get an A
i, it is designated as h to the distance of straight line
i, the distance of some B is g to the arc profile
i, get point search downwards along angular bisector DK, up to satisfying g
I-1<h
I-1, and g
i>h
i, determine that then the center of circle is positioned at A
iWith A
I-1Between the zone;
(c) 1/10th of the plain spacing of capture as step-length, at an A
iWith A
I-1Between range searching, setting threshold T, work as judgment formula | g
I-1-h
I-1| when<T sets up, determine littler zone;
(d) one of percentage of the plain spacing of capture is as step-length, and the method continuation search according to previous step obtains accurate central coordinate of circle value.
Step 6: just can obtain each sub-pixel edge point and edge geometric parameter on the edge that cutter will measure according to step 4 and step 5, just can obtain the envelope at the edge that whole cutter will measure thus.
The inventive method overall procedure (as shown in Figure 1) is:
The first step: absorb the colored static cutter image of a width of cloth and import computer, convert thereof into the gray level image and the bianry image of cutter;
Second step: the bianry image that the first step obtains is done morphologic filtering, gradient, refinement, pruning preliminary treatment, obtain the thick edge of cutter bianry image;
The 3rd step: the profile tracking is done at the cutter bianry image edge that second step obtained, extracted the characteristic point (angle point, point of contact) of cutter bianry image profile, and identify the straightway and the arc section of cutter bianry image profile;
The 4th step: the 3rd straightway and the arc section that goes on foot the cutter gray level image profile that obtains done the sub-pixel edge location, obtain the sub-pixel edge point of cutter gray level image;
The 5th step: the 4th cutter image border straightway that obtain of step and the sub-pixel edge point of arc section are calculated, obtain high-precision tool geometrical parameter.
Essence of the present invention is to utilize digital image processing method, orients the accurate coordinates position of cutter image border, calculates the precise geometrical parameter of cutter, and can obtain measuring cutter edge envelope, reaches the purpose that cutter is accurately measured.
Advantage of the present invention: the invention provides a kind of precision measurement method of static cutter image, it has, and precision height, noise resisting ability are strong, accurate positioning, and good reproducibility, characteristics such as easy and simple to handle can accurately be extracted the geological information of cutter image apace.
Description of drawings
Fig. 1 is the overview flow chart of the inventive method
Fig. 2 is a contour feature point extracting method flow chart in the inventive method
Fig. 3 is a sub-pixel positioning method flow diagram in image border in the inventive method
Fig. 4 is the image of tested cutter in the inventive method
Wherein, (a) be coloured image; (b) be gray level image; (c) be bianry image
Fig. 5 is cutter contour images and a contour feature point extraction schematic diagram in the inventive method
Wherein, (a) be contour images; (b) be the contour feature point area schematic; (c) be the contour feature point schematic diagram
Fig. 6 is the tool length instrumentation plan in the inventive method
Wherein, A, B, C, D are respectively selected points on the cutter both sides of edges straight line, and L is the distance between AB and the CD;
Fig. 7 is the cutter angle measuring schematic diagram in the inventive method
Wherein, θ is the angle of two straight lines on the cutter edge
Fig. 8 is the tool radius instrumentation plan in the inventive method
Wherein, M, E, N, F are selected points on the tangent line of arc section both sides, cutter edge, and D is the intersection point of ME and NF, and A is the center of circle of circular arc, and B is the intersection point of AD and circular arc, and R is the radius of arc section on the cutter edge.
Fig. 9 is the tool length measured drawing in the inventive method.
Figure 10 is the cutting-tool angle measured drawing in the inventive method.
Figure 11 is the tool radius measured drawing in the inventive method.
Figure 12 is a cutter edge of image envelope diagram in the inventive method.
Wherein 1 is knife back part, the 2,3,4, the 5th, need the cutter edge envelope of measuring.
The specific embodiment
A kind of accurate measurement of cutter, according to the following steps:
1. utilize digital camera to take the colored cutter image of a width of cloth, by USB interface the cutter image is imported computer, and convert thereof into gray level image and bianry image, as shown in Figure 4.
2. the cutter bianry image is made morphologic filtering, and gradient, refinement, pruning series of preprocessing obtain the thick edge of cutter bianry image, shown in Fig. 5 (a).
3. profile is made at cutter bianry image edge and followed the tracks of, and extract the characteristic point of cutter image outline, then cutter bianry image profile is done the segmentation identification of straight line and circular arc.
4. utilize the B-spline curves approximating method that the cutter gray-scale Image Edge is made sub-pixel positioning.
5. utilize the geometrical relationship of cutter image border, calculate high-precision tool geometrical parameter, shown in Fig. 6,7,8.
Concrete image processing method case is as follows:
(1) utilizes digital camera to take the colored cutter image of a width of cloth, with cutter coloured image input computer, convert thereof into gray level image by USB interface, and adopt the maximum variance threshold method to convert it into bianry image, as shown in Figure 4.
(2) the cutter bianry image that step 1 is obtained utilizes the morphological image operator to do morphologic filtering, morphology gradient, refinement, a series of processing of pruning, can obtain the bianry image edge of cutter, shown in Fig. 5 (a).
(3) the cutter bianry image edge that step 2 is obtained, at first utilize chain code eight neighborhood algorithm keeps track to obtain cutter image outline data, utilize the least square fitting contour curve again, determine the characteristic point (angle point, point of contact) of cutter image outline in conjunction with slope and curvature information, and cutter image outline curve is done segmentation discern, as Fig. 5 (b) with (c).
At first calculate the curvature of being had a few on the profile, search out the point that there is local maximum in curvature on the profile, obtain the zone of contour feature point in view of the above according to the curvature method.
Further locate fact characteristic point again, in the contour feature point zone that previous step obtains, utilize the least square fitting contour curve, obtain the left and right sides slope of each point.
The left and right sides of every left and right sides slope of locating to calculate it in the zone, and calculating then slope differences score value, difference maximum place is angle point.Every curvature of locating to calculate this some place in the zone, and calculate the curvature difference score value, curvature difference maximum place is the point of contact.
Utilize the localization method at above-mentioned angle point and point of contact can determine contour feature point, again according to the curvature value of cutter image outline with circular arc on the cutter image outline and straight segments, segmentation method is: the curvature in the both sides, point of contact to profile point is judged, be that the bigger side of curvature is an arc section, otherwise the less side of curvature is a straightway;
(4) the cutter gray level image that step 1 is obtained, the two-dimentional approximating method that adopts a kind of B spline-fit to combine with least square method are done the sub-pixel edge location.
The sub-pixel edge detection and localization is divided into 3 steps:
1. be the center with current point, determine a rectangular area, in the zone longitudinally data make least square fitting, the data that obtain revising by the curvilinear equation after the match;
2. data are done horizontal B spline-fit in the revised rectangular area that previous step is obtained, and obtain the curvilinear function after the match;
3. according to the curvilinear function after the match, ask for the first derivative of curvilinear function, determine the sub-pixel edge point of cutter image at the first derivative maximum;
(5) obtaining cutter image outline curve segmentation by step 3 is straightway and arc section, the sub-pixel edge localization method of employing step 4 obtains the sub-pixel edge point of cutter image on straightway and arc section, utilize the tool geometrical parameter measuring method again, calculate high-precision tool geometrical parameter;
The geometric parameter measurement method of described cutter is as follows:
When 1. measuring length, as shown in Figure 6, reconnaissance respectively utilizes least square fitting to go out the linear equation of AB, CD again on cutter image border both sides AB, CD, and the last i point of AB can calculate d by the distance between beeline and dot formula to the distance of CD
i, calculate average distance then
When 2. taking measurement of an angle, as shown in Figure 7.Utilize least square fitting to go out linear equation, the relation according to slope and angle calculates two included angle of straight line θ again;
When 3. measuring radius, as shown in Figure 8, adopt center of circle method to measure;
Center of circle method is meant the center of circle of obtaining circular arc earlier, utilizes the center of circle to try to achieve radius to the distance of circular arc tangential line again, and its concrete steps are as follows:
(a) utilize least square fitting to go out the linear equation of circular arc both sides, straight line ME, NF are prolonged the D that intersects at a point, on their angular bisector DK, search for the center of circle;
(b) on angular bisector DK, get i some A
i, it is designated as h to the distance of straight line
i, the distance of some B is g to the arc profile
i, on angular bisector DK, get point search, up to satisfying g
I-1<h
I-1, and g
i>h
i, determine that then the center of circle is positioned at A
iWith A
I-1Between the zone;
(c) 1/10th of the plain spacing of capture as step-length, at an A
iWith A
I-1Between range searching, setting threshold T, work as judgment formula | g
I-1-h
I-1| when<T sets up, determine littler zone;
(d) one of percentage of the plain spacing of capture is as step-length, and the method continuation search according to previous step obtains accurate central coordinate of circle value.
According to above-mentioned method, the establishment corresponding program just can obtain the cutter edge envelope that will measure, as shown in figure 12, so just can obtain any any accurate coordinates position on the cutter edge envelope, and realization is to the accurate measurement of this tool geometrical parameter.
Measure by the picture point of choosing on the cutter edge envelope that needs to measure, the data that record with high precision instrument compare, and measurement result shows that the measure error of tool length, angle and radius is in 2.5%.
The precision measurement method of a kind of static cutter image provided by the invention has precision height, anti-noise Strong, the accurate positioning of acoustic energy power, good reproducibility, the characteristics such as easy and simple to handle, it can be used for based on number In the cutting tools measurement system that the word image is processed, detect as the cutter in the Digit Control Machine Tool processing is accurate.