Improved two rectilineal intervals are from the sub-pixel precision measuring method
Technical field:
The present invention relates to physical field, relate in particular to measuring technique, particularly measure the technology of air line distance in the field of machine vision, concrete is that a kind of improved two rectilineal intervals are from the sub-pixel precision measuring method.
Background technology:
In the prior art, the machine vision metrology method can be divided into monocular vision measurement, binocular vision measurement in space and three kinds of forms of used for multi-vision visual measurement according to the number of the sensor that adopts.Wherein, it is high to hardware requirement that binocular vision measurement in space and used for multi-vision visual are measured form, and complicated to the demarcation and the registration process of camera, measuring speed is slower in the application scenario that online in real time is measured.And monocular vision measurement form adopts the geometric similarity mensuration, has characteristic of simple structure, need not complicated demarcation and registration process, and still, the geometric distortion meeting of image makes linearity not enough, and measuring error is bigger.
Summary of the invention:
The object of the present invention is to provide a kind of improved two rectilineal intervals from the sub-pixel precision measuring method, described this improved two rectilineal intervals will solve in the prior art from the sub-pixel precision measuring method that piecture geometry fault causes the bigger technical matters of measuring error in the monocular camera machine vision measuring method.
This improved two rectilineal intervals of the present invention are from the sub-pixel precision measuring method; Comprise a step of utilizing single camera to gather the target object contour images, a step that adopts the sub-pixel edge extraction algorithm from the target object contour images, to obtain the step at edge and the sub-pix contour edge pruned the better linearity of acquisition; Wherein, After the described step that from the target object contour images, obtains the edge is accomplished, from the edge, filter out two target straight lines, then two target straight lines are pruned respectively; Improve the linearity of target line, measure the distance between two target straight lines after pruning at last.
Further, before the step that adopts the sub-pixel edge extraction algorithm from the target object contour images, to obtain the edge is carried out, the threshold value of image segmentation is set earlier; The target object contour images of then camera being obtained is made Threshold Segmentation, selects the high bright parts of target object contour images, rejects the part beyond the fringe region then; Select the background area again, the structural element of use 3 * 3 corrodes conversion to inside, background area, obtains the border of background area; Then this border is carried out just pruning; Keep possible boundary profile, do the circular expander computing then, obtain the zone of edge in-scope; Again the field of definition of target object contour images is dwindled the size of target area for this reason, will offer the sub-pixel edge extraction algorithm then at the image in this field of definition and ask marginal operation.
Further; After the described step that from the target object contour images, obtains the edge is accomplished; Use the RAMER algorithm that edge fitting is polygon, and the segmenting edge profile, straight-line segment is split and defines ± interval at 10 degree angles filters out two target straight lines.
The present invention and prior art are compared, and its effect is actively with tangible.The present invention uses the geometric similarity mensuration in the monocular vision measurement; The optical axis of the object plane of testee and one camera system is vertical and be parallel to the picture plane; Object and its image satisfy similarity relation; Read pixel point parameter from image, and multiply by enlargement factor, can obtain the actual physical dimension parameter of object.From image, obtain the edge of the sub-pix between two straight lines earlier, again the edge is pruned, improve linearity, correct distortion, the image after pruning is carried out the match of straight line, measure the distance of calculating between two straight lines at last.The present invention compares binocular and multi-eye stereo vision, has characteristic of simple structure, need not complicated demarcation and registration process, has reduced the error that piecture geometry fault produces simultaneously.
Description of drawings:
Fig. 1 is the synoptic diagram of improved two rectilineal intervals of the present invention from an embodiment of sub-pixel precision measuring method.
Fig. 2 is the improved two rectilineal intervals of the present invention images that camera uses backlight illumination back to obtain to the right side of target object in an embodiment of sub-pixel precision measuring method.
Fig. 3 to be improved two rectilineal intervals of the present invention use in an embodiment of the sub-pixel precision measuring method canny operator asks in field of definition edge, according to the synoptic diagram at the resulting three sections edges of ramer linear feature dividing wheel profile.
Fig. 4 is the synoptic diagram that improved two rectilineal intervals of the present invention leave the linear edge that blocks among the embodiment of sub-pixel precision measuring method.
Fig. 5 is the synoptic diagram of the linear edge of improved two rectilineal intervals of the present invention after an embodiment cathetus degree of sub-pixel precision measuring method is optimized.
Embodiment:
Embodiment 1:
As depicted in figs. 1 and 2; Improved two rectilineal intervals of the present invention are from the sub-pixel precision measuring method; Comprise a step and a step that adopts the sub-pixel edge extraction algorithm from target object 2 contour images, to obtain the edge of utilizing single camera 4 to gather target object 2 contour images, wherein, after the described step that from target object 2 contour images, obtains the edge is accomplished; From the edge, filter out two target straight lines; Then two target straight lines are pruned respectively, improved the linearity of target line, measure the distance between two target straight lines after pruning at last.
Utilize in the step that single camera 4 gathers target objects 2 contour images described, utilize 1 pair of target object 2 of a back light to do dark ground illumination, with the optical axis of camera 4 perpendicular to back light 1.
Target object 2 in the present embodiment is annular objects.Target object 2 is placed on the table top of a worktable 3, and the optical axis of camera 4 is parallel with the table top of worktable 3
The threshold value of image segmentation is set earlier, and the annular object contour images of then camera being obtained is made Threshold Segmentation, selects the high bright parts of target object 2 contour images.
Owing to have noise, the connected region at two places about can calculating earlier.
Through the screening connected region area, will comprise annular object elevation information about two zones elect, reject unwanted zone.
Select the background area then, the structural element of use 3 * 3 corrodes conversion to inside, background area, obtains the border of background area; Then this border is carried out just pruning; Keep interested boundary profile, do the circular expander computing then, obtain comprising the target area of needed two straight lines; Again the field of definition of target object 2 contour images is dwindled the size of target area for this reason, will offer the sub-pixel edge extraction algorithm then at the image in this field of definition and ask marginal operation.
Re-using the image of canny operator in this field of definition carries out sub-pix and asks marginal operation.The Alpha value is made as 1.
As shown in Figure 3, after obtaining the edge, use the RAMER algorithm that edge fitting is polygon, and the segmenting edge profile, straight-line segment is split and defines ± interval at 10 degree angles filters out two target straight lines.
Linear edge as shown in Figure 4, as to block, curved transition is big.
As shown in Figure 5, before carrying out line measurement, target line is done pruning, the straight-line segment that curvature is bigger blocks certain distance from end points, and the distance in the present embodiment is 5 to put pixel, to improve linearity, corrects distortion.Each puts the vertical range of lower whorl profile on the outline line through calculating at last, uses the method for adding up to try to achieve the mean distance between the straight line of match.