Disclosure of Invention
The invention provides a high-efficiency and high-precision automatic sorting system and method for micro workpieces, aiming at overcoming at least one defect in the prior art. The specific technical scheme is as follows:
a micro-workpiece automatic sorting system based on machine vision comprises a workpiece transportation module, an image acquisition module, an image processing module, a central control module, a workpiece screening module and a direct-current voltage stabilizing module;
the workpiece conveying module is used for conveying workpieces to working stations of the image acquisition module and the workpiece screening module;
the image acquisition module is connected with the image processing module and the central control module and is used for acquiring picture information of the workpiece and sending the picture information to the image processing module;
the image processing module is connected with the central control module and is used for analyzing whether the workpiece is a qualified workpiece or not and sending an analysis result to the central control module;
the central control module is used for controlling the on-off of the image acquisition module, receiving the information sent by the image processing module and controlling the on-off of the workpiece screening module;
the workpiece screening module is used for distributing workpieces to a certified product area and a defective product area;
the direct current voltage stabilizing module is connected with the central control module and the image acquisition module and used for providing stable direct current voltage for the central control module and the image acquisition module.
The invention can acquire the contour information of the workpiece by utilizing the image acquisition module, accurately identify whether the workpiece is qualified or not by utilizing the image processing module and utilizing the computer technology, and then partition the workpiece by utilizing the central control module and the workpiece screening module. The invention can detect small precise workpieces with high efficiency and high precision, and overcomes the problems of low efficiency, low precision, easy fatigue and easy influence of subjective factors of a manual detection method.
Preferably, the workpiece transportation module comprises a vibration disc and a stepping motor turntable, the image acquisition module comprises an optical fiber sensor, a light source and an industrial camera, the image processing module is a PC upper computer, the central control module is a PLC controller, the workpiece screening module comprises an air gun and a baffle, and the direct current voltage stabilizing module is a 12V direct current voltage stabilizing module;
the vibration disc is connected with the stepping motor turntable and can convey workpieces to the stepping motor turntable, the optical fiber sensor and the industrial camera are arranged above the stepping motor turntable, the light source is arranged below the stepping motor turntable, the optical fiber sensor, the light source and the industrial camera are electrically connected with the PLC, the industrial camera is further electrically connected with the PC upper computer, the PC upper computer is electrically connected with the PLC, the air gun and the baffle are arranged on the side face of the stepping motor turntable, the air gun and the baffle are matched to convey the workpieces to a genuine product area or a defective product area, and the 12V direct-current voltage stabilizing module is electrically connected with the optical fiber sensor and the PLC.
The industrial CCD camera is ingeniously utilized to collect data of a workpiece, the collected data are sent to an industrial PC upper computer through internet access communication, the PC upper computer calls an image processing algorithm to analyze and process the data and then sends out a control signal, the PLC controller is utilized to process the control signal, and the air gun is controlled to screen out defective products. The invention comprehensively applies the technologies of digital image processing, mechanical control, computer software and hardware and the like, is suitable for the automatic sorting work of precise workpieces with smaller size, and has high sorting precision.
Furthermore, the industrial camera is a Basler 200 ten thousand pixel industrial CCD camera, a telecentric lens is adopted, the visual field is 13.5mm, a gigabit Ethernet transmission line is used for transmitting images, and the industrial camera has high image acquisition quality and fast data transmission speed.
Furthermore, the stepping motor turntable is composed of a stepping motor and high-flatness transparent glass, the stepping motor drives the turntable to rotate through a linkage relation, the high-flatness glass is good in transparency, a light source is favorable for irradiating a workpiece to form a clear outline, and a camera can acquire a high-quality workpiece outline picture.
Furthermore, the light source is a background light source, and can provide a good light source for a camera to form a high-contrast contour workpiece image.
A micro-workpiece sorting method based on machine vision by utilizing the micro-workpiece sorting system comprises the following steps:
step 1: setting relevant parameters on a PC (personal computer) according to user requirements and field environment factors, and operating the system;
step 2: the vibration disc vibrates the workpiece to enable the workpiece to automatically fall to the stepping motor turntable, and meanwhile, the stepping motor turntable rotates at a fixed speed;
and step 3: the stepping motor turntable drives the workpiece to rotate, and the optical fiber sensor senses the arrival of the workpiece and informs the PLC controller of the arrival;
and 4, step 4: after sensing the arrival of a workpiece, the PLC starts a background light source after a period of time and triggers an industrial camera to take a picture;
and 5: the industrial camera captures a high-contrast contour map of a background light source penetrating through a workpiece and sends the high-contrast contour map to a PC (personal computer) for image processing;
step 6: after the PC upper computer is used for processing, the quality/defective product signals are sent to the PLC controller, the PLC controller controls the air gun and the baffle, and the workpieces are sent to a quality area or a defective product area.
The method provided by the invention can accurately acquire the workpiece contour image, and then the acquired workpiece contour image is analyzed by utilizing the PC upper computer, so that the precise detection of the micro-workpiece can be realized, and the function of automatic sorting is realized.
Further, the graphic processing process of the PC upper computer comprises camera calibration, preprocessing, sub-pixel edge detection and polygon approximation algorithm processing in sequence;
the camera calibration is used for obtaining the size and coordinate information of the workpiece, the preprocessing is used for removing noise points, the sub-pixel edge detection is used for obtaining the chamfering outline of the workpiece, and the polygon approximation algorithm processing is used for analyzing whether the chamfering outline of the workpiece is qualified or not. The sub-pixel edge detection method has high precision of obtaining the chamfering outline of the workpiece, which can reach +/-0.02 mm, and the accuracy of analyzing the defect information of the outline of the workpiece by a polygon approximation algorithm is high.
Furthermore, the camera calibration is based on a rectangular grid-shaped circular target plane calibration method, the size and coordinate information of the outline of the workpiece can be obtained, the parameters are optimized in a nonlinear mode, the camera distortion is reduced, and the visual measurement accuracy is improved.
Further, the method for detecting the sub-pixel edge is used for extracting the chamfer outline of the workpiece, and comprises the following specific steps:
calculating to obtain a minimum circumscribed rectangle of the workpiece outline based on the size and coordinate information of the workpiece outline obtained by calibrating the camera, and solving the edge point coordinate and the center point coordinate of the minimum circumscribed rectangle;
obtaining a second rectangle which is intersected with the contour of the workpiece and has a length shorter than that of the minimum circumscribed rectangle according to the edge point coordinate and the center point coordinate of the minimum circumscribed rectangle of the contour of the workpiece and the length of the chamfer of the workpiece, wherein the center point coordinate of the second rectangle is the same as that of the minimum circumscribed rectangle, the length of the second rectangle is equal to the length of the minimum circumscribed rectangle minus 2 times of the length of the chamfer of the workpiece, and the width of the second rectangle is not less than the width of the minimum circumscribed rectangle;
subtracting the second rectangular contour from the edge contour of the workpiece to obtain a difference value, wherein the difference value is two closed and disjoint contours;
and acquiring a workpiece chamfering profile according to the characteristics of the chamfering profile, selecting the profile with short length and small area as the workpiece chamfering profile if the workpiece chamfering length is short and the area is small, and selecting the profile with long length and large area as the workpiece chamfering profile if the workpiece chamfering length is long and the area is large.
The polygon approximation algorithm is used for analyzing whether the chamfer contour is qualified or not, and the specific method is as follows:
calculating to obtain a connecting line of two end points of the chamfer profile curve of the workpiece;
calculating the distance from the farthest point of the workpiece chamfer contour curve from the connecting line to the connecting line;
comparing whether the distance from the farthest point to the connecting line is smaller than a set value; if the curve is larger than the set value, dividing the workpiece chamfer contour curve into two sections by taking the farthest point as a dividing point;
repeating the 3 steps until the distance from the farthest point of the new curve to the connecting line of the corresponding new curve end point is smaller than a set value;
analyzing whether the chamfering profile has defects, and if the workpiece chamfering profile is divided into two sections of arcs, determining the workpiece chamfering profile is qualified; if the workpiece chamfer profile is divided into three or more arc sections, the workpiece chamfer profile is an unqualified chamfer profile.
Compared with the prior art, the beneficial effects are:
the industrial CCD camera is skillfully utilized to collect data of the workpiece, the collected data is sent to the industrial PC through internet access communication, the PC calls a designed image processing algorithm to analyze and process the data and then sends out a control signal, and the PLC is utilized to process the control signal and control the air gun to screen out defective products. An illumination module is also arranged to enhance the characteristics of the workpiece and eliminate the interference of other natural light. The system applies image processing technologies such as camera calibration, sub-pixel edge detection and the like to process, analyze and detect the contour picture of the workpiece, and the precision of the measured external dimension of the workpiece can reach +/-0.02 mm. When the arc chamfer is detected, the system creatively uses a polygon approximation algorithm to analyze the defect condition of the workpiece according to the shape of the arc, thereby greatly improving the identification accuracy of the arc of the workpiece.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent; for the purpose of better illustrating the embodiments, certain features of the drawings may be omitted, enlarged or reduced, and do not represent the size of an actual product; it will be understood by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted. The positional relationships depicted in the drawings are for illustrative purposes only and are not to be construed as limiting the present patent.
As shown in fig. 1, an automatic sorting system for micro-workpieces based on machine vision comprises a vibration disc, a stepping motor turntable, an optical fiber sensor, a light source, an industrial camera, a PC upper computer, a PLC controller, an air gun, a baffle and a 12V dc voltage stabilizing module.
The vibration disc is connected with the stepping motor rotary disc and can convey workpieces to the stepping motor rotary disc, the optical fiber sensor and the industrial camera are arranged above the stepping motor rotary disc, the light source is arranged below the stepping motor rotary disc, the optical fiber sensor, the light source and the industrial camera are electrically connected with the PLC, the industrial camera is further electrically connected with the PC upper computer, the PC upper computer is electrically connected with the PLC, the air gun and the baffle are arranged on the side face of the stepping motor rotary disc, the air gun and the baffle are matched to convey the workpieces to a genuine product area or a defective product area, and the 12V direct-current voltage stabilizing module is electrically connected with the optical fiber sensor and the PLC.
Specifically, the industrial camera is a Basler 200 ten thousand pixel industrial CCD camera, a telecentric lens is adopted, the visual field is 13.5mm, and a gigabit Ethernet transmission line is used for transmitting images.
Specifically, the stepping motor turntable is composed of a stepping motor and high-flatness transparent glass, and the stepping motor drives the turntable to rotate through a linkage relation.
Specifically, the light source is a background light source.
As shown in fig. 2, a method for sorting micro workpieces based on machine vision by using the micro workpiece sorting system includes the following steps:
a micro-workpiece sorting method based on machine vision by utilizing the micro-workpiece sorting system comprises the following steps:
step 1: setting relevant parameters on a PC (personal computer) according to user requirements and field environment factors, and operating the system;
step 2: the vibration disc vibrates the workpiece to enable the workpiece to automatically fall down to the stepping motor turntable, and meanwhile, the turntable rotates at a fixed speed;
and step 3: the stepping motor turntable drives the workpiece to rotate, and the optical fiber sensor senses the arrival of the workpiece and informs the PLC controller of the arrival;
and 4, step 4: after sensing the arrival of a workpiece, the PLC starts a background light source after a period of time and triggers an industrial camera to take a picture;
and 5: the industrial camera captures a high-contrast contour map of a background light source penetrating through a workpiece and sends the high-contrast contour map to a PC (personal computer) for image processing;
step 6: after the PC upper computer is used for processing, the quality/defective product signals are sent to the PLC controller, the PLC controller controls the air gun and the baffle, and the workpieces are sent to a quality area or a defective product area.
Specifically, the graphic processing process of the PC upper computer comprises camera calibration, preprocessing, sub-pixel edge detection and polygon approximation algorithm processing in sequence;
the camera calibration is used for obtaining the size and coordinate information of the workpiece, the preprocessing is used for removing noise points, the sub-pixel edge detection is used for obtaining the chamfering outline of the workpiece, and the polygon approximation algorithm processing is used for analyzing whether the chamfering outline of the workpiece is qualified or not.
Specifically, the camera calibration is based on a rectangular grid-shaped circular target plane calibration method, and the dimension and coordinate information of the workpiece outline can be obtained.
Specifically, as shown in fig. 3, the method for detecting the sub-pixel edge is used to extract the chamfer profile of the workpiece, and the specific method is as follows:
calculating to obtain a minimum circumscribed rectangle of the workpiece outline based on the size and coordinate information of the workpiece outline obtained by calibrating the camera, and solving the edge point coordinate and the center point coordinate of the minimum circumscribed rectangle;
obtaining a second rectangle which is intersected with the workpiece outline and has a length shorter than that of the minimum circumscribed rectangle according to the edge point coordinate and the center point coordinate of the minimum circumscribed rectangle of the workpiece outline and the length of the workpiece chamfer (the length of the workpiece chamfer is a known condition and can be determined according to the type of the workpiece), wherein the center point coordinate of the second rectangle is the same as that of the minimum circumscribed rectangle, the length of the second rectangle is equal to the length of the minimum circumscribed rectangle minus 2 times of the length of the workpiece chamfer, and the width of the second rectangle is not less than the width of the minimum circumscribed rectangle;
subtracting the second rectangular contour from the edge contour of the workpiece to obtain a difference value, wherein the difference value is two closed and disjoint contours;
and acquiring a workpiece chamfering profile according to the characteristics of the chamfering profile, selecting the profile with short length and small area as the workpiece chamfering profile if the workpiece chamfering length is short and the area is small, and selecting the profile with long length and large area as the workpiece chamfering profile if the workpiece chamfering length is long and the area is large. The workpiece chamfering feature of the present embodiment (the feature is a known condition, and may be determined according to the type of the workpiece) is short in length and small in area, and therefore the left-hand contour is selected as the workpiece chamfering contour.
Specifically, the polygon approximation algorithm is used for analyzing whether the chamfer contour is qualified, and the specific method is as follows:
calculating to obtain a connecting line of two end points of the chamfer profile curve of the workpiece;
calculating the distance from the farthest point of the workpiece chamfer contour curve from the connecting line to the connecting line;
comparing whether the distance from the farthest point to the connecting line is smaller than a set value; if the set value is larger than the set value, dividing the workpiece chamfer contour curve into two sections by taking the farthest point as a dividing point, wherein the set value can be predetermined according to the type of the workpiece;
repeating the 3 steps until the distance from the farthest point of the new curve to the connecting line of the corresponding new curve end point is smaller than a set value;
analyzing whether the chamfering profile has defects, and if the workpiece chamfering profile is divided into two sections of arcs, determining the workpiece chamfering profile is qualified; if the workpiece chamfer profile is divided into three or more arc sections, the workpiece chamfer profile is an unqualified chamfer profile.
As shown in fig. 4, for convenience of description, the workpiece chamfer contour may be subjected to dimension reduction processing, and replaced with points 1-6, that is, the workpiece chamfer contour has only six points, and the specific process of the polygon approximation algorithm is as follows: firstly, a line segment 16 is formed by connecting a point 1 and a point 6, a point 3 is assumed to be the farthest point from the workpiece chamfering outline to the line segment 16, and the distance from the point 3 to the line segment 16 is larger than a set value, so that the workpiece chamfering outline is divided into two sections by taking the point 3 as a dividing point, namely, the left half part of the workpiece chamfering outline and the right half part of the workpiece chamfering outline, then the point 1 and the point 3 are connected to form a line segment 13, the point 3 and the point 6 are connected to form a line segment 36, a point 2 is assumed to be the farthest point from the left half part of the workpiece chamfering outline to the line segment 13, a point 4 is the farthest point from the right half part of the workpiece chamfering outline to the line segment 36, the distance from the point 2 to the line segment 13 is smaller than the set value, the distance from the point 4 to the line segment 36 is smaller than the set value, the dividing process is finished, and the workpiece chamfering outline is divided into two sections, so that the workpiece chamfering is qualified.
It should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.