Disclosure of Invention
The invention aims to provide a visual detection method for a precision part, which is used for improving the detection speed and precision of the part and improving the detection effect of the part.
The technical scheme adopted by the invention for solving the technical problems is as follows: the precision part visual detection method comprises the following steps:
the method comprises the following steps of 'object image shadow' joint detection, wherein the joint detection step is used for acquiring a gap value between a part and a reflection image of the part;
the method comprises a segmentation detection step, a part side view image obtaining step and a part side view image obtaining step, wherein the segmentation detection step is used for dividing the part side view image into a plurality of interested areas and determining the deformation condition of each interested area;
and a grouping and sorting step, which is used for grouping and detecting the parts with the deformation in the preset deviation range according to the specified tolerance.
The object image and shadow combined detection step specifically comprises the following steps: and acquiring a part side view image of the part and the part which are in contact with each other relative to the reflection of the glass object stage, and acquiring a clearance value of which the size is two times of the actual deformation amount between the reflection corresponding to the part and the part.
The step of segment detection specifically comprises: dividing the side view image of the part into a plurality of interested areas, sequentially detecting the maximum gap value or the minimum gap value in each interested area, knowing the maximum deformation of the part through the maximum gap value, and knowing whether the part is in contact with the glass object stage or not through the minimum gap value; and returning a gap value after each interested area is detected, and calibrating each interested area respectively.
When the acquired side view of the part is divided into a plurality of regions of interest, a plurality of regions of interest with first areas are arranged on the main body part of the part; setting a plurality of interested areas of a second area on the complex-form part of the part to cover the complex-form part of the whole part; wherein the first area is larger than the second area.
The region of interest is a rectangular region.
And each region of interest adopts a sub-pixel measurement technology during detection.
And a step of accurately positioning a detection area is also included between the step of segment detection and the step of grouping and sorting, and the step of accurately positioning the detection area is used for reducing positioning errors caused by pose change.
The accurate positioning detection area specifically comprises the following steps: and setting two side edges of the head and the tail of the part in the side-view image of the part as two positioning references, and selecting one positioning reference which is closer to the interested area for positioning.
The grouping and sorting steps are specifically as follows: and detecting the parts with the deformation amount within the preset deviation range in groups by limiting the gap value of each region of interest, wherein each group specifies a tolerance.
The invention also provides a precision part visual detection device, which comprises: a glass stage; the camera is a side-view camera, the position of a lens of the camera is slightly higher than the part on the glass object stage, and the camera is used for acquiring a digital image of the side-view direction of the part; the positioning device is used for adjusting the pose of the part; and the computer processing device is used for controlling and processing the camera and the positioning device to complete visual detection, receiving feedback information of the camera and the positioning device in real time, and detecting the parts on the glass object stage by adopting any one of the detection methods.
Advantageous effects
Due to the adoption of the technical scheme, compared with the prior art, the invention has the following advantages and positive effects: according to the invention, the deformation is defined by the clearance value between the part and the reflection image of the part, so that the influence of the plane of the objective table is avoided; according to the invention, the deformation of the elongated part in the side view direction is detected by adopting a segmented detection method, so that the flexible control on the detection effect can be realized; in the invention, the situation that the slight pose change of a part on the glass object stage is inevitable is considered, a plurality of interested area positioning benchmarks are adopted, and the positioning error caused by the pose change is reduced by accurately positioning the detection area; the invention detects the parts by a grouping sorting method, thereby improving the detection effect. Under the condition of limited hardware resolution, the detection method is an effective new strategy for detecting large-size ultra-precise parts.
Detailed Description
The invention will be further illustrated with reference to the following specific examples. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and such equivalents may fall within the scope of the present invention as defined in the appended claims.
The embodiment of the invention relates to a precision part visual detection method, which mainly comprises the following steps: the method comprises the following steps of 'object image shadow' joint detection, wherein the joint detection step is used for acquiring a gap value between a part and a reflection image of the part; the method comprises a segmentation detection step, a part side view image obtaining step and a part side view image obtaining step, wherein the segmentation detection step is used for dividing the part side view image into a plurality of interested areas and determining the deformation condition of each interested area; a grouping and sorting step, which is used for grouping and detecting the parts with the deformation in the preset deviation range according to the specified tolerance; and a step of accurately positioning a detection area is also included between the step of segment detection and the step of grouping and sorting, and the step of accurately positioning the detection area is used for reducing positioning errors caused by pose change.
Use general machine vision detection device as the basis in this embodiment, general vision detection device includes camera, glass objective table, positioner and computer processing device etc. the camera is for looking sideways at the camera for the part looks sideways at the acquirement of direction digital image, the glass objective table is used for bearing and carries the part fast, positioner is used for adjusting the part to certain position appearance. While high-speed detection is realized by the device, because the contact between the part and the objective table cannot be avoided, a proper detection strategy is needed to avoid the influence of the detection strategy on the detection precision.
The object image and shadow combined detection method adopted in the embodiment is to take an image of a part in contact with an inverted shadow of the part rather than a side view image of the part in contact with an object stage by slightly raising a camera lens above the part placed on the glass object stage, so that the influence of the plane of the object stage is avoided. In the side view, the part body and the reflection image thereof are both in a strip shape, and a gap with the size being two times of the actual deformation amount is formed between the part and the reflection image. That is, the deformation of the part is amplified by one time, and the detection precision is indirectly improved.
In the sectional detection method in the embodiment, the side view of the elongated strip-shaped part is divided into a plurality of interested areas according to a certain detection range, the maximum gap value or the minimum gap value in each area is sequentially detected, and the deformation condition of the area is judged. Each detection area is respectively calibrated, so that the measurement error caused by lens imaging distortion is avoided, and meanwhile, the detection precision is improved by combining a sub-pixel measurement technology under the condition of limited hardware performance. The setting scheme of the region of interest is as follows: arranging an interested area with a larger area on the part main body; in a part of a fine structure having a part of a complicated morphology, a region of interest having a small area and a large number is provided to cover the entire fine structure part. The detection of one interested area returns one gap value, the shape of a fine structure part is complex, the gap value is changed greatly, and the single maximum gap value or the minimum gap value can not control the overall deformation of the hook part. The deformation amount can be limited on the whole by arranging more small-area interested areas at the hook, the false detection is avoided, and the detection effect is improved.
The part is tiled on the objective table, after the pose deflection angle alpha is formed, the position and the projection length are changed, if the interested area cannot be correspondingly adjusted, the detection position of the interested area with a smaller area is greatly deviated, and a larger positioning error is easy to generate.
In view of the above situation, the method for accurately positioning the detection area is adopted in the embodiment: the side lines on the two sides of the head and the tail of the part in the side view are set as positioning references, and the selection of the positioning reference of the region of interest is based on the closer distance, so that the positioning error is reduced, and the positioning precision is improved.
In the embodiment, a grouping sorting method is further added, the gap value of each interested area is limited, the parts with deformation within a certain deviation range are divided into a plurality of groups to be detected, each group specifies a smaller tolerance, and the consistency effect of each group is better.
The present invention is further described below by a specific embodiment, in which a large-sized ultra-precise flat elongated hook part is used as a visual detection object, and a general visual detection device is used as a basis to improve detection precision and detection effect by an innovative detection strategy. The detection strategy adopts methods of 'object image shadow' joint detection, sectional detection, accurate positioning of detection areas, grouping and sorting and the like.
As shown in fig. 1, a schematic view of a machine vision inspection apparatus according to an embodiment of the present invention mainly includes a side-view camera for acquiring a side-view direction digital image of a part, a glass stage capable of rotating rapidly for carrying and rapidly transporting the part, a positioning device for adjusting the part to a certain pose, and a computer processing device. After being sent to the glass objective table, the parts sequentially pass through the positioning device and the side-looking camera and finally enter the classification box. When the machine vision detection device is used for realizing high-speed detection, because the contact between the part and the objective table cannot be avoided, a proper detection strategy is required to avoid the influence of the part on the detection precision, so that the requirement of the part detection precision is met.
As shown in fig. 2, which is a side view of the part laid on the glass stage in the embodiment of the present invention, in the "object image shadow" combined detection method, the camera lens is slightly higher than the plane 3 of the glass stage, so as to capture the part 1 and its reflection 2 relative to the glass stage, the image of the part 1 itself and the image of its reflection 2 are theoretically equal in size, and they can be clearly separated from the plane 3 of the glass stage, thereby avoiding the influence of the stage. The body of the part 1 and its reflection 2 are elongated in side view, and if deformed, there will be a gap between the part 1 and the reflection 2, otherwise they will coincide in contact with each other. In fig. 2, the right side hook of the part 1 always has a gap because the thickness is smaller than the body. The size of the gap is twice the actual gap between the part and the glass stage.
Further, the shape of the region of interest in the embodiment is rectangular, as shown in fig. 3, which is a schematic diagram of a segmentation detection method in the embodiment of the present invention, the segmentation detection method does not directly detect the deformation of the whole part, but divides the part into a plurality of rectangular regions of interest 4-10 according to a certain detection range, wherein 4-7 are rectangular regions of interest with a larger area, that is, regions of interest with a first area; 8-10 are rectangular interested areas with small areas, namely interested areas with second areas, and the maximum gap value or the minimum gap value in each rectangular interested area is detected in sequence. The maximum deformation is known from the maximum gap value, and whether the part is in contact with the glass object stage is known from the minimum gap value.
In the figure 3, rectangular interested areas 8-10 are arranged at a hook with a complex shape, the main characteristics are that the area is small, the quantity is large, and the hook is wholly subdivided into a plurality of rectangular interested areas. The reason for setting more rectangular interesting areas is that each rectangular interesting area can return a maximum gap value or a minimum gap value, the bending forms of the inner side and the outer side of the hook are complex, and the change of the gap value is large.
As shown in fig. 4, a hook deformation diagram of the component according to the embodiment of the present invention is shown, the hook has various deformations as shown in fig. 4, and a single gap value index cannot reflect the deformation of the hook portion. The small-area rectangular region of interest is arranged at the hook, so that the deformation can be limited on the whole, the false detection is avoided, and the detection effect is improved.
As shown in fig. 5, for the part pose deflection diagram according to the embodiment of the present invention, the part is tiled on the object stage, and after the pose deflection angle α is obtained, the position coordinate and the projection length are changed, if the rectangular region of interest divided as above cannot be adjusted accordingly, the rectangular region of interest with a smaller area at the hook is likely to generate a larger positioning error, and the detection area will generate a larger offset and even exceed the hook. For this case, the method for accurately locating the detection area: as shown in FIG. 3, two side lines of the head and the tail of the part image are set as apositioning reference 11 and apositioning reference 12, and the region of interest is positioned by the closer positioning reference. The rectangular regions of interest 4-5 are determined by specifying a distance from apositioning reference 11, and the rectangular regions of interest 6-10 are determined by specifying a distance from apositioning reference 12.
The group sorting method according to the present embodiment detects the parts deformed within a certain deviation range by limiting the gap value of each rectangular region of interest, and divides the parts into several groups, each group defining a small tolerance, and preferably detects the parts having a hook portion deformation within ± 2a in 4 groups of deformations (-2a, -a), (-a, 0), (0, a), (a, 2a), for example, so that the uniformity effect of each group is good.
As shown in fig. 6, which is a schematic diagram illustrating the result of the visual inspection method according to the embodiment of the present invention, a batch of parts obtained by the visual inspection method have good consistency after being arranged at equal intervals, and have no obvious bending phenomenon, which indicates that the inspection method has good inspection effect.
The invention also relates to a precision part visual inspection device, which comprises: a glass stage; the camera is a side-view camera, the position of a lens of the camera is slightly higher than the part on the glass object stage, and the camera is used for acquiring a digital image of the side-view direction of the part; the positioning device is used for adjusting the pose of the part; and the computer processing device is used for controlling and processing the camera and the positioning device to complete visual detection, receiving feedback information of the camera and the positioning device in real time, and detecting the parts on the glass object stage by adopting the detection method in the embodiment.
Therefore, the invention can realize flexible control on the detection effect of the precision parts, reduce the positioning error, improve the detection effect and provide a new idea for the detection of large-size ultra-precision parts by adopting a series of precision part visual detection methods such as 'object image shadow' combined detection step, sectional detection step and grouping sorting step and further combining with the step of accurately positioning the detection area.