Shaft part measuring system based on motion scanning and image acquisition
Through the shaft parts measurement system based on motion scanning and image acquisition, the problems of low detection efficiency and inability to detect multiple sizes at the same time in the existing technology are solved, automatic detection and automatic blanking are realized, and the detection efficiency is significantly improved.
Patent Information
- Application Number
- CN202411031993.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-11
AI Technical Summary
The existing inspection methods for shaft parts are inefficient and cannot detect multiple sizes at the same time. The operation is cumbersome and requires high operator skills and complex maintenance.
Using a shaft parts measurement system based on motion scanning and image acquisition, the upper computer controls the lower computer, uses the visual system to collect the product's outer contour image, calculates different types of outer contour dimensions, and obtains product quality classification based on the set size comparison. Realize automatic detection and automatic blanking.
It realizes the automatic detection of shaft parts, can detect multiple size types at the same time, improves the detection efficiency, and realizes fully automatic detection by automatically distinguishing the quality and blanking process, significantly improving the efficiency of parts detection.
Smart Images

Figure CN118758181A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of parts detection, and relates to a shaft parts measuring system based on motion scanning and image acquisition. Background Art
[0002] Shaft parts are one of the most common parts in the machinery industry. The evaluation of the size and form tolerance of shaft parts, especially precision shaft parts, is an important means to measure the processing quality of shaft parts. At present, shaft parts are mainly tested by general measuring tools or special shaft measuring instruments: general measuring tools have strong applicability but relatively low detection efficiency and accuracy, while special shaft measuring instruments require high operator skills and are cumbersome to maintain.
[0003] At present, the dimensional inspection of shaft parts is not limited to the inspection of one dimension, but usually includes the inspection of length, height, coaxiality, etc. However, the above-mentioned inspection method can only inspect one dimension at a time. When other dimensions need to be inspected, other inspection equipment needs to be replaced, which is not only cumbersome but also inefficient. Summary of the invention
[0004] In order to overcome at least one of the deficiencies of the prior art, the present invention provides a shaft parts measurement system based on motion scanning and image acquisition.
[0005] In order to achieve the above-mentioned purpose, the present invention adopts the following technical scheme: a shaft parts measurement system based on motion scanning and image acquisition, including a host computer, a slave computer, a loading device, a transmission device, a lifting device, a visual system, a clamping device, and a unloading device. The host computer controls the loading device, the transmission device, the lifting device, the visual system, the clamping device, and the unloading device through the slave computer to perform actions; the visual system collects the product outer contour image, the host computer calculates the product outer contour size according to the product outer contour image, and compares the outer contour sizes of different types with the set sizes to obtain the quality classification of the product, and the unloading device classifies the products and unloads them according to the product quality classification.
[0006] Furthermore, the loading device includes a loading frame, a loading robot and a loading position sensor. The loading position sensor is installed on the transmission device, and the loading position sensor is used to detect whether the product is placed on the transmission device.
[0007] Furthermore, the transmission device includes a transmission motor, a transmission frame, a transmission belt and a plurality of carrying devices. The carrying devices are arranged in an array on the transmission belt along the transmission direction of the transmission device. The transmission belt is provided with a plurality of lifting ports, which are connected up and down. The plurality of lifting ports are arranged in an array along the transmission direction of the transmission device. The carrying device includes two groups of carrying blocks, which are symmetrically distributed on both sides of the lifting ports. The two groups of carrying blocks respectively carry the two ends of the product, and the middle end of the product is located above the lifting ports. The transmission frame is also provided with a detection position sensor, which is located at a set detection position. The detection position sensor is used to detect whether the product reaches the detection position.
[0008] Furthermore, the visual system includes a visual moving mechanism and a measuring head. The visual moving mechanism is connected to the frame. The visual moving mechanism is connected to the measuring head. The visual moving mechanism is configured as a power drive mechanism. The movement of the measuring head is controlled by the visual moving mechanism. There are two groups of measuring heads, and the two groups of measuring heads are symmetrically configured.
[0009] Furthermore, the clamping device includes a first clamping mechanism and a second clamping mechanism, the first clamping mechanism and the second clamping mechanism are located in the front-to-back direction, respectively clamping the two ends of the product, the first clamping mechanism includes a first cylinder, a first clamping jaw and a first clamping jaw detection sensor, the first cylinder is fixedly connected to the frame, the first cylinder is connected to the first clamping jaw, the first clamping jaw detection sensor is connected to the first clamping jaw, the first clamping jaw detection sensor is used to detect whether the first clamping jaw clamps the detection part, the second cylinder is fixedly connected to the frame, the second cylinder is connected to the second clamping jaw, the second clamping jaw is used to clamp the detection part, the second clamping jaw detection sensor is connected to the second clamping jaw, and the second clamping jaw detection sensor is used to detect whether the second clamping jaw clamps the detection part.
[0010] Furthermore, the host computer includes a database, a self-check module, a data acquisition module, a system status monitoring module, a human-computer interaction module, a measurement template making module, a product size data processing module, a product position detection module, an abnormal data matching module, and a decision tree creation module.
[0011] Furthermore, the data acquisition module is used to acquire a product outline data processing object, which is an image. The product outline data processing object is used for subsequent size calculation, specifically including:
[0012] Host computer signal acquisition module: The host computer obtains the loading completion signal of the loading robot and the unloading completion signal of the unloading robot;
[0013] The loading manipulator transmits the loading result and the unloading robot transmits the unloading result to the PLC. The PLC sets the loading completion and unloading completion flag registers. The host computer reads the loading and unloading status by scanning the PLC registers to obtain the loading completion signal of the loading manipulator and the unloading completion signal of the unloading robot.
[0014] Motion parameter writing module: write motion parameters to PLC;
[0015] Single product measurement module: used to measure a single product;
[0016] Signal feedback module: used to read sensor data once the host computer receives a motion completion signal sent back by the PLC.
[0017] Furthermore, before the measurement starts, the overall measurement area of the single product is divided into multiple measurement areas according to the template setting requirements. After the measuring head completes the data collection of a single measurement area, the lower computer controls the motion mechanism to move the measuring head to the next measurement area, and repeats the execution to complete the surface profile data collection of the entire shaft. The single product measurement module is used for the data collection of the outer contour of a single product, specifically including
[0018] Single-area image acquisition module: After the loading device moves the product from the loading frame to the set position and clamps it, it is used to capture the image of the inspection area where the product cq is located when the measuring head moves to the qth shooting position, save the cq image, and transmit the cq image to the host computer. The number of shots P is counted + 1;
[0019] The product is divided into several detection areas along its axial direction, namely c1...cq...cp. The 1st...q...pth shooting positions are set. The first shooting position corresponds to the c1 detection area...the pth shooting position corresponds to the cp detection area. q is the serial number of the current detection area, and p is the total number of the divided detection areas.
[0020] Shooting counting module: used to determine whether P is less than p. If so, it is considered that the product scanning is not completed, and a motion instruction is sent to the PLC. The measuring head moves to the q+1th shooting position, and the sequence number q=q+1 is reset. The single-area image acquisition module continues to capture the next detection area image. If not, it is considered that the product scanning is completed.
[0021] Image preprocessing module: used to perform preliminary processing on c1...cq...cp images to obtain preprocessed images;
[0022] The c1...cq...cp images contain all the outer contour dimension data of the product. The pre-processed images of each inspection area are obtained by pre-processing the images.
[0023] Size acquisition module: used to read the template detection area information and obtain the product outer contour size data contained in the pre-processed image.
[0024] Furthermore, the product size data processing module includes
[0025] Line-to-line spacing calculation module: used for line-to-line spacing calculation when measuring outer diameter and height when the measurement type is outer diameter and height;
[0026] Ball diameter calculation module: used to calculate the size of the ball diameter when the measurement type is ball diameter;
[0027] Sphericity calculation module; used for sphericity size calculation when the measurement type is sphericity;
[0028] Coaxiality calculation module: used for coaxiality dimension calculation when the measurement type is coaxiality;
[0029] Thread pitch calculation module: used to calculate the thread pitch size when the measurement type is thread pitch.
[0030] Furthermore, the calculation method of the line-to-line spacing calculation module is:
[0031] According to the measurement type set by the template, the edge points of the corresponding preprocessed image are extracted; the edge points are fitted to two straight lines based on the least squares method; the distance D between the two straight lines is calculated; the distance D is compared with the standard value set by the template and each tolerance range to obtain the product quality classification of the measurement type;
[0032] The calculation formula for spacing D is:
[0033] The line with more edge points is the target line L2, and the line with fewer edge points is the original line L1;
[0034] Assume that the starting point P1 and the end point P2 of the original line L1, the starting point P3 and the end point P4 of the target line L2, the coordinates of P1, P2, P3, and P4 are known, which are P1(X1, Y1), P2(X2, Y2), P3(X3, Y3), and P4(X4, Y4), respectively. The target line is translated to the starting point P1, so that the end point P4 of the target line coincides with P1, and is set as L3. The target line is translated to the starting point P1, so that the starting point P3 of the target line coincides with P1, and is set as L4.
[0035] Calculate the translation offset Lm1 between L3 and L2 and the translation offset Lm2 between L4 and L2;
[0036] Lm1(X1-X4, Y1-Y4), Lm2(X1-X3, Y1-Y3);
[0037] According to the translation offset, calculate the distance between the end point P3O of L3 far away from P1, the end point P4O of L4 far away from P1 and the end point P2 of L1, and select the standard line according to the distance;
[0038] Coordinates of the two endpoints of L3:
[0039] ([(X1, Y1), (P3OX, P3OY)]) = ([(X1, Y1), (X3+X1-X4, Y3+Y1-Y4)]);
[0040] The distance d3O between P3O and the end point P2 of L1 is:
[0041]
[0042] Coordinates of the two end points of L4:
[0043] ([(X1, Y1), (P4OX, P4OY)])===([(X1, Y1), (X4+X1-X3, Y4+Y1-Y3)]);
[0044]
[0045] Determine the size of d3O and d40. If d3O is less than d40, determine that the angle between L3 and L2 is an acute angle. If d3O is greater than d40, determine that the angle between L4 and L2 is an acute angle. Select the straight line with an acute angle with L2 as the standard line for subsequent calculations. The angle between L4 and L2 is an acute angle, and L4 is the standard line.
[0046] Select the midpoint of the line connecting P40 of L4 and P2 of L1, connect P1 and the midpoint to obtain a parallel constraint line;
[0047] The coordinates of the two end points of the parallel constraint line are [(X1, Y1), (P4OX+X2) / 2, (P4OY+Y2) / 2];
[0048] Calculate the slope k of the parallel constraint line;
[0049] K=((P4OX+X2) / 2-X1) / ((P4OY+Y2) / 2-Y1)
[0050] =(P4OX+X2-2X1) / (P4OY+Y2-2Y1);
[0051] The parallel constraint line is translated so that the endpoint of the parallel constraint line coincides with the midpoint of L1, and the target parallel constraint line L5 is obtained;
[0052] The L5 slope formula is y = kx + b, where k is the slope of the parallel constraint line;
[0053] The coordinates of the midpoint of L1 are ((X1+X2) / 2), (Y1+Y2) / 2));
[0054] Therefore, b = (Y1 + Y2) / 2 - k(X1 + X2) / 2;
[0055] Calculate the spacing D;
[0056] The spacing D is the distance from the point to the line, that is, the distance from the midpoint of L2 to the target parallel constraint line L5;
[0057]
[0058] Where A=k, B=-1, C=b, (x0, y0) is the coordinate of the midpoint of L2, (x0, y0)=((X3+X4) / 2), (Y3+Y4) / 2));
[0059] We can get:
[0060]
[0061] In summary, the present invention is beneficial in that:
[0062] The present invention realizes automatic detection of part size and automatic detection of various size types of individual parts through a shaft part measuring device, and simultaneously automatically distinguishes the quality of parts and automatically unloads materials according to the quality. Compared with the existing detection methods, the present invention greatly improves the efficiency of part detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a schematic diagram of the shaft parts measuring device of the present invention.
[0064] Figure 2 It is a schematic diagram of the jacking device of the present invention.
[0065] Figure 3 Schematic diagram of the visual system and gripper device of the present invention.
[0066] Figure 4 a- Figure 4 e is a schematic diagram of the structure of the line-to-line spacing calculation of the present invention.
[0067] Figure 5 a- Figure 5 d is a schematic diagram of the structure of the ball diameter calculation of the present invention. DETAILED DESCRIPTION
[0068] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0069] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0070] All directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, horizontal, vertical...) are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly.
[0071] Due to installation errors and other reasons, the parallel relationship referred to in the embodiments of the present invention may actually be an approximately parallel relationship, and the vertical relationship may actually be an approximately vertical relationship.
[0072] Embodiment 1:
[0073] like Figure 1-Figure 5 As shown, a shaft parts measurement system based on motion scanning and image acquisition includes a host computer, a slave computer, a loading device 1, a transmission device 2, a lifting device 3, a visual system 4, a clamping device 5, and a unloading device 7. The host computer controls the loading device 1, the transmission device 2, the lifting device 3, the visual system 4, the clamping device 5, and the unloading device 7 through the slave computer to perform actions.
[0074] The loading device 1 and the unloading device 7 are respectively connected to the transmission device 2, the loading device 1 moves the product (parts to be tested) to the transmission device 2 for loading, the transmission device 2 drives the product to move to the detection position, the lifting device 3 lifts the product moved to the detection position to the set position, the clamping device 5 clamps the product, and the visual system 4 collects the image of the product.
[0075] For the convenience of orientation description, this embodiment establishes an xyz coordinate system, where the x-axis is the left-right direction, which is also the transmission direction of the transmission device 2, the y-axis is the front-back direction, which is also the width direction of the transmission device 2, and the z-axis is the height direction.
[0076] The loading device 1 includes a loading frame 10, a loading robot 11 and a loading position sensor 12. The loading position sensor 12 is installed on the transmission device 2. The loading position sensor 12 is used to detect whether the product is placed on the transmission device 2. The loading frame 10 has several products built in. The loading robot 11 clamps the product and places it on the transmission device 2. After the loading position sensor 12 detects the product, the transmission device 2 starts to move the product to the detection position.
[0077] The transmission device 2 is configured as a motor-driven assembly line structure, specifically including a transmission motor, a transmission frame 21, a transmission belt 22 and a plurality of carrying devices 23. The transmission motor and the transmission belt 22 are respectively connected to the transmission frame 21, and a plurality of carrying devices 23 are distributed in an array on the transmission belt 22 along the transmission direction of the transmission device 2. The carrying device 23 is used to carry products. The transmission motor drives the transmission belt 22 to transmit, thereby driving the carrying device 23 and the products it carries to move synchronously.
[0078] The conveyor belt 22 is provided with a plurality of lifting openings 221, which are connected up and down, and are arranged in an array along the transmission direction of the transmission device 2. During the movement of the conveyor belt 22, the plurality of lifting openings 221 are sequentially opposite to the lifting device 3. The number of the lifting openings 221 corresponds to the number of the carrying devices 23, and the two are arranged in a one-to-one correspondence.
[0079] The carrying device 23 includes two groups of carrying blocks 231, which are symmetrically distributed on both sides of the lifting port 221. The two groups of carrying blocks 231 respectively carry the two ends of the product, and the middle end of the product is located above the lifting port 221. When the conveyor belt 22 drives the product to move to the detection position, that is, the product is located above the lifting device 3, the lifting device 3 starts to lift the product to the specified position.
[0080] Preferably, the bearing block 231 is provided with a bearing opening (not shown in the figure), and the bearing opening is a V-shaped structure. The product is placed in the bearing opening, and the V-shaped bearing opening can limit the product.
[0081] The transmission frame 21 is also provided with a detection position sensor 24. The detection position sensor 24 is located at a set detection position. The detection position sensor 24 is used to detect whether the product reaches the detection position.
[0082] The lifting device 3 includes a lifting cylinder 31 and a lifting plate 32. The lifting plate 32 is fixedly connected to the output shaft of the lifting cylinder 31. The lifting plate 32 is used to lift the product. The lifting cylinder 31 starts and controls the lifting plate 32 to drive the product to move up and down. The lifting cylinder 31 is provided with a proximity switch, and the proximity switch can be used to determine whether the product is lifted into place.
[0083] The visual system 4 includes a visual moving mechanism 41 and a measuring head 42. The visual moving mechanism 41 is connected to the frame 6. The visual moving mechanism 41 is connected to the measuring head 42. The visual moving mechanism 41 is configured as a power drive mechanism. The measuring head 42 is controlled to move along the y-axis direction by the visual moving mechanism 41. The power drive mechanism can be configured as a cylinder drive, a ball screw drive, a synchronous belt drive or other structures, which is not limited in the present application.
[0084] There are two groups of measuring heads 42, and the two groups of measuring heads 42 are symmetrically arranged along the x direction, so as to facilitate comprehensive scanning and detection of the product.
[0085] The clamping device 5 includes a first clamping mechanism 51 and a second clamping mechanism 52. The first clamping mechanism 51 and the second clamping mechanism 52 are located in the front-to-back direction to clamp two ends of the product respectively.
[0086] The first clamping mechanism 51 includes a first cylinder 511, a first clamping jaw 512 and a first clamping jaw detection sensor 513. The first cylinder 511 is fixedly connected to the frame 6. The first cylinder 511 is connected to the first clamping jaw 512. The first cylinder 511 drives the first clamping jaw 512 to move. The first clamping jaw 512 is used to clamp the detection part. The first clamping jaw detection sensor 513 is connected to the first clamping jaw 512. The first clamping jaw detection sensor 513 is used to detect whether the first clamping jaw 512 clamps the detection part. The second cylinder 521 is fixedly connected to the frame 6. The second cylinder 521 is connected to the second clamping jaw 522. The second cylinder 521 drives the second clamping jaw 522 to move. The second clamping jaw 522 is used to clamp the detection part. The second clamping jaw detection sensor 523 is connected to the second clamping jaw 522. The second clamping jaw detection sensor 523 is used to detect whether the second clamping jaw 522 clamps the detection part.
[0087] The unloading device 7 includes an unloading robot 71, an unloading classification frame 72 and an unloading sensor (not shown). The unloading sensor is used to detect whether the measured parts have reached the unloading position. The unloading classification frame 72 is divided into a finished product frame and a defective product frame. The unloading robot 71 places the measured parts at the unloading position in the finished product frame or the defective product frame according to the measurement results of the product.
[0088] The upper computer has built-in upper computer software, and the upper computer communicates with the lower computer (PLC) to obtain real-time data and process, monitor, control and manage and calculate product dimensions. The product dimensions include ball diameter, roundness, outer diameter, height, coaxiality, thread pitch, etc.
[0089] The host computer includes a database, a self-check module, a data acquisition module, a system status monitoring module, a human-computer interaction module, a measurement template making module, a product size data processing module, a product position detection module, an abnormal data matching module, and a decision tree creation module;
[0090] The database is used to store the data of the host computer software, including user data, instruction data and related logs;
[0091] The self-test module is used to perform self-test after the system is powered on.
[0092] Database self-check module: used to determine whether the system is connected to the database, and enter the login interface after the connection is determined;
[0093] Login self-check module: used to determine whether the actual operator has logged in successfully after entering the login interface;
[0094] Lower computer status self-check module: used to determine whether the lower computer status is normal after successful login;
[0095] Measuring head status self-check module: used to judge whether the measuring head 42 is in normal state when the lower computer is in normal state;
[0096] Self-check status output module: When the lower computer status self-check module and the measuring head status self-check module fail or pass the self-check, the pass / fail self-check status output module will be output to the display interface.
[0097] The data acquisition module is used to collect the product contour data processing object, which is an image. The product contour data processing is used for subsequent size calculation, specifically including:
[0098] Host computer signal acquisition module: The host computer obtains the loading completion signal of the loading manipulator 11 and the unloading completion signal of the unloading robot 71;
[0099] The loading robot 11 transmits the loading and unloading results to the PLC, and the PLC sets the loading completion and unloading completion flag registers to 1. The host computer reads the loading and unloading conditions by scanning the PLC registers, thereby obtaining the loading completion signals of the loading robot 11 and the unloading completion signals of the unloading robot 71.
[0100] Motion parameter writing module: write motion parameters to PLC;
[0101] Single product measurement module: used to measure a single product;
[0102] Signal feedback module: used to read sensor data once the host computer receives a motion completion signal sent back by the PLC.
[0103] Before starting the measurement, the overall measurement area of a single product is divided into multiple measurement areas according to the template setting requirements. After the measuring head completes the data collection of a single measurement area, the lower computer controls the motion mechanism to move the measuring head to the next measurement area, and repeats the execution to complete the surface profile data collection of the entire axis. The single product measurement module is used for the data collection of the outer contour of a single product, including
[0104] Single-area image acquisition module: after the loading device moves the product from the loading frame 10 to the set position and clamps it, it is used to move the measuring head 42 to the qth shooting position to shoot the image of the inspection area where the product cq is located, save the cq image, transmit the cq image to the host computer, and the number of shots P is counted +1;
[0105] The product is divided into several detection areas along its axial direction, namely c1...cq...cp. The 1st...q...pth shooting positions are set. The first shooting position corresponds to the c1 detection area...the pth shooting position corresponds to the cp detection area. q is the serial number of the current detection area, and p is the total number of the divided detection areas.
[0106] Shooting counting module: used to determine whether P is less than p. If so, it is considered that the product scanning is not completed, and a motion instruction is sent to the PLC. The measuring head 42 moves to the q+1th shooting position, and the sequence number q=q+1 is reset. The single-area image acquisition module continues to acquire the next detection area image. If not, it is considered that the product scanning is completed.
[0107] Image preprocessing module: used to perform preliminary processing on c1...cq...cp images to obtain preprocessed images;
[0108] The c1...cq...cp images contain all the outer contour dimension data of the product. The pre-processed images of each inspection area are obtained by pre-processing the images.
[0109] Size acquisition module: used to read the template detection area information and obtain the product outer contour size data contained in the pre-processed image.
[0110] The image preprocessing module also includes an image preprocessing module, which is used to perform preprocessing on the c1...cq...cp images, specifically including:
[0111] Image stitching module: used to stitch c1...cq...cp images;
[0112] According to the detection area and corner point information set by the template, when there is an overlapping area, the two images are spliced;
[0113] The image stitching module uses the phase correlation algorithm to stitch images, including
[0114] 1. Perform Fourier transform on the image to be stitched to obtain its frequency domain representation;
[0115] 2: Convert the frequency domain representation into phase representation and calculate the phase difference between different images;
[0116] 3: Calculate phase correlation based on phase difference;
[0117] By normalizing the phase difference, the phase correlation value is obtained, which is used to evaluate the similarity between different images;
[0118] 4: Determine the registration parameters based on the maximum phase correlation;
[0119] Find the registration parameter corresponding to the maximum phase correlation value, and use the parameter to perform image registration and stitching;
[0120] Image cropping module: crops the spliced image according to the detection area drawn when the template is made to obtain a cropped image;
[0121] Image denoising module: perform bilateral filtering denoising on the cropped image and interpolate based on the least squares method to obtain a preprocessed image.
[0122] System status monitoring module, which is used to monitor the equipment operation status in real time by reading the status bit of the lower computer in real time, and automatically issue an alarm or prompt information when an abnormal situation occurs;
[0123] The human-computer interaction module is used by operators to manage the human-computer interaction function of the upper computer software to realize information exchange and operation control between humans and machines. The human-computer interaction function includes display interface, control function, data management, and user authority management.
[0124] The display interface is used by actual operators to facilitate data observation and operation. The equipment status and measurement information are displayed in charts. The measurement information is product production information and single-piece production quality. The display interface also includes a login button and a motion setting button. Click the login button to enter the login interface. The login interface includes a user login mode and a visitor mode. When the actual operator cannot enter through the user login mode, he can enter through the visitor mode; click the motion parameter setting button to enter the motion parameter setting interface. The motion parameters are written to the PLC through the motion parameter setting interface. The motion parameters include the detection position and the motion speed of the transmission device 2.
[0125] Control function: used by actual operators to control the equipment through the host computer, such as starting, stopping, changing products (changing measurement templates), manually controlling equipment, etc.
[0126] Data management: used by management personnel to manage measurement template data and product size quality production data;
[0127] User authority management: used by management personnel to manage and control the operating authority of users in the system to ensure the security and confidentiality of data.
[0128] Measurement template making module: used for template making, including
[0129] Data acquisition module: used to obtain the outer contour data of real-time products, and the historical template directly reads the outer contour data of products;
[0130] Decision tree process module: used to determine whether to generate a decision tree process. If so, the size result is calculated based on the outer contour data of the product, and the size result is marked. The decision tree process is incremented by 1, and the decision tree process counting module is started. If not, the product detection area is set and the decision tree module is started;
[0131] Decision tree module: used to determine whether to generate a decision tree. If yes, load the motion parameters and measurement parameters, calculate the size results according to the product's outer contour data, and mark the size results. The decision tree process is incremented by 1, and the decision tree process counting module is started. If no, the corner point extraction module is started.
[0132] The dimension results are marked to classify the product quality according to the dimension results;
[0133] Decision tree process counting module: determines whether the number of decision tree processes is greater than the total number of decision tree processes. If so, it iteratively generates a decision tree and writes the decision tree into the template;
[0134] Corner point extraction module: extract the corner point features of the current data, write the data corner point features into the template, and save the template.
[0135] This embodiment also includes a detection area setting module, which is used to set the detection area of the product. Specifically, it includes
[0136] Measurement preprocessing module: used to add product measurement items in the module and select measurement type;
[0137] Measurement types include ball diameter, sphericity, outer diameter, height, coaxiality, thread pitch, etc.
[0138] Measurement area drawing module: used to draw the measurement area corresponding to the measurement type and accurately determine the starting point and end point of the measurement area;
[0139] Measurement dimension setting module: set the standard value and tolerance range of the measurement type, and set the product quality classification within each tolerance range;
[0140] For example, if the standard value of the ball diameter of a product is z, the tolerance range of the good product is set to (z1, z2), the tolerance range of the defective product is set to (z3, z4), and so on;
[0141] Measurement saving module: after all measurement items are set, motion parameters are generated according to the measurement area, measurement parameters and motion parameters are saved, and templates are saved.
[0142] The product dimension data processing module includes a line-to-line spacing calculation module, a spherical diameter calculation module, a sphericity calculation module, a coaxiality calculation module and a thread pitch calculation module. The line-to-line spacing calculation module, the spherical diameter calculation module, the sphericity calculation module, the coaxiality calculation module and the thread pitch calculation module are used to calculate different types of dimension data of the outer contour.
[0143] When the measurement type is outer diameter and height, the line-to-line spacing calculation module is used to calculate the line-to-line spacing when measuring outer diameter and height. The calculation method is:
[0144] According to the measurement type set by the template, the edge points of the corresponding preprocessed image are extracted; the edge points are fitted to two straight lines based on the least squares method; the distance D between the two straight lines is calculated; the distance D is compared with the standard value set by the template and each tolerance range to obtain the product quality classification of the measurement type;
[0145] The calculation formula for spacing D is:
[0146] The line with more edge points is the target line L2, and the line with fewer edge points is the original line L1;
[0147] Assume that the starting point P1 and the end point P2 of the original line L1, the starting point P3 and the end point P4 of the target line L2, the coordinates of P1, P2, P3, and P4 are known, which are P1(X1, Y1), P2(X2, Y2), P3(X3, Y3), and P4(X4, Y4), respectively. The target line is translated to the starting point P1, so that the end point P4 of the target line coincides with P1. Figure 4 b, and set it as L3, translate the target straight line to the starting point P1, so that the starting point P3 of the target straight line coincides with P1. Figure 4 c, and set to L4;
[0148] Calculate the translation offset Lm1 between L3 and L2 and the translation offset Lm2 between L4 and L2;
[0149] Lm1(X1-X4, Y1-Y4), Lm2(X1-X3, Y1-Y3);
[0150] According to the translation offset, calculate the distance between the end point P3O of L3 far away from P1, the end point P4O of L4 far away from P1 and the end point P2 of L1, and select the standard line according to the distance;
[0151] Coordinates of the two endpoints of L3:
[0152] ([(X1, Y1), (P3OX, P3OY)]) = ([(X1, Y1), (X3+X1-X4, Y3+Y1-Y4)]);
[0153] The distance d3O between P3O and the end point P2 of L1 is:
[0154]
[0155] Coordinates of the two end points of L4:
[0156] ([(X1, Y1), (P4OX, P4OY)])===([(X1, Y1), (X4+X1-X3, Y4+Y1-Y3)]);
[0157]
[0158] Determine the size of d3O and d40. If d3O is less than d40, determine that the angle between L3 and L2 is an acute angle. If d3O is greater than d40, determine that the angle between L4 and L2 is an acute angle. Select the straight line with an acute angle with L2 as the standard line for subsequent calculations. In this embodiment, Figure 4 As shown in b and 4c, the angle between L4 and L2 is an acute angle, and L4 is the standard line;
[0159] Select the midpoint of the line connecting P40 of L4 and P2 of L1, connect P1 and the midpoint to obtain a parallel constraint line;
[0160] The coordinates of the two end points of the parallel constraint line are [(X1, Y1), (P4OX+X2) / 2, (P4OY+Y2) / 2];
[0161] Calculate the slope k of the parallel constraint line;
[0162] K=((P4OX+X2) / 2-X1) / ((P4OY+Y2) / 2-Y1)
[0163] =(P4OX+X2-2X1) / (P4OY+Y2-2Y1);
[0164] The parallel constraint line is translated so that the endpoint of the parallel constraint line coincides with the midpoint of L1, and the target parallel constraint line L5 is obtained;
[0165] The L5 slope formula is y = kx + b, where k is the slope of the parallel constraint line;
[0166] The coordinates of the midpoint of L1 are ((X1+X2) / 2), (Y1+Y2) / 2));
[0167] Therefore, b = (Y1 + Y2) / 2 - k(X1 + X2) / 2;
[0168] Calculate the spacing D;
[0169] The spacing D is the distance from the point to the line, that is, the distance from the midpoint of L2 to the target parallel constraint line L5;
[0170]
[0171] Where A=k, B=-1, C=b, (x0, y0) are the coordinates of the midpoint of L2, and (x0, y0)=((X3+X4) / 2), (Y3+Y4) / 2)).
[0172] We can get:
[0173]
[0174] like Figure 5 a- Figure 5 As shown in Figure d, when the measurement type is spherical diameter, the spherical diameter calculation module calculates the spherical diameter. According to the template settings, there are 4 spherical diameter calculation modes:
[0175] 1. Direct fitting to find the diameter without circle search;
[0176] 2. Find the maximum distance without circle search and use it as the diameter;
[0177] 3. Contour extraction with circle search and diameter calculation of circle fitting;
[0178] 4. Contour extraction with circle search, find the maximum distance as the diameter;
[0179] The specific method of mode 1 is:
[0180] According to the measurement type set by the template, the contour data of the corresponding pre-processed image is extracted, such as Figure 5 As shown in a; based on the least squares method, the circle is fitted and the standard equation of the circle is obtained to obtain the radius of the circle, which is multiplied by 2 to obtain the diameter;
[0181] When editing the template, the spherical diameter detection area set by the template is drawn in an area smaller than the spherical range, that is, it does not include the non-spherical contour and there will still be no non-spherical contour range after the sample has a small offset;
[0182] The specific steps of Mode 2 are as follows:
[0183] According to the measurement type set by the template, the contour data of the corresponding pre-processed image is extracted, such as Figure 5 As shown in a, based on the least squares method of fitting a circle, the maximum distance from the point on the left contour to the point on the right contour is calculated, the middle 80% range of data is taken, the maximum and minimum values are removed, and the average is taken as the diameter;
[0184] When editing the template, the spherical diameter detection area set by the template is drawn in an area smaller than the spherical range, that is, it does not include the non-spherical contour and there will still be no non-spherical contour range after the sample has a small offset;
[0185] The specific method of mode 3 is:
[0186] According to the measurement type set by the template, the corresponding pre-processed image is extracted, and the circle search position is corrected and the contour data is extracted. The circle position is located using Hough transform, such as Figure 5 As shown in b, based on the least squares method to fit the circle, the standard equation of the circle is obtained, the radius of the circle is obtained, and the diameter is obtained by multiplying it by 2;
[0187] When editing the template, the spherical diameter detection area set by the template is drawn in an area smaller than the spherical range, that is, it does not include the non-spherical contour and there will still be no non-spherical contour range after the sample has a small offset;
[0188] The specific method of mode 4 is:
[0189] According to the measurement type set by the template, the corresponding pre-processed image is extracted, and the circle search position is corrected and the contour data is extracted. The circle position is located using Hough transform, such as Figure 5 As shown in b, based on the least squares method of fitting the circle, the maximum distance from the point on the left contour to the point on the right contour is calculated, the middle 80% range of data is taken, the maximum and minimum values are removed, and the average is taken as the diameter.
[0190] When editing the template, the spherical diameter detection area set by the template is drawn in an area smaller than the spherical range, that is, it does not include the non-spherical contour and there will still be no non-spherical contour range after the sample has a small offset;
[0191] The ball diameter calculation module also includes a circle position positioning module, which is used to perform Hough transform to locate the circle position. The circle position positioning module includes
[0192] Circle parameter setting module: used to set the parameters of the circle: the horizontal coordinate a0 of the center of the circle, the vertical coordinate b0 of the center of the circle and the radius r of the circle;
[0193] Hough transform space module: used for Hough transform space, calculates a0, b0 and r ranges based on contour point data;
[0194] a0 (x-axis coordinate of the center of the circle) range: the midline position of the two contours expands to both ends (2mm);
[0195] b0 (circle center y-axis coordinate) range: template editing selection range (image height range);
[0196] r (circle radius) range: the minimum distance from any point on the left contour to all points on the right contour divided by 2 - the image width divided by 2;
[0197] Array module: used to create the accumulator array of Hough transform;
[0198] Create an accumulator array (three-dimensional array) whose dimensions correspond to the value range of a0, b0 and r in the parameter space (the precision of a0, b0 and r are all 0.1, and the Hough circle finding is only used as the approximate position of the positioning circle. The specific result is calculated based on the contour data. Here, the step size is 0.1 to reduce the amount of calculation). Initially, the values of all elements are zero;
[0199] Hough transform module: used to perform Hough transform on each edge point;
[0200] For each contour point in the image, traverse the possible range of r and theta values from the center of the circle to the contour point, then calculate the corresponding a0 and b0 values, and increase the count at the corresponding position in the accumulator array, theta (90°-270° for the left contour, 0°-90° and 270° to 360° for the right contour each increase by 1°).
[0201] a0=xr\cos*theta
[0202] b0=yr\s in*theta
[0203] x and y are the coordinates of the contour point, r is the radius, and theta is the angle from the center of the circle to the contour point;
[0204] Peak module: used to find the peak value in the accumulator array;
[0205] Find the maximum value in the accumulator array, the position of which gives the estimated values of the center a0, b0 and radius r of the circle, and perform threshold processing on the values in the accumulator array, retaining only values greater than a certain threshold to filter out insignificant peaks;
[0206] Contour extraction module: used for contour extraction;
[0207] First, use the found center a0, b0 and radius r to obtain the circle shown by the double-dash line (in order to improve the calculation efficiency, the traversal step size is set to 0.1mm, so that the center coordinates of the circle found by Hough have a deviation of about 0.1mm in the x and y directions, and the radius also has a deviation of 0.1). Then, keep the center unchanged, add 0.2mm to the radius r (such as the dotted circle), calculate the intersection of the left and right contours and the circle with the increased radius (as shown in the figure, the points form a square), and finally, according to the intersection of the circle and the contour, reduce it inward (10% to 20%) to obtain the contour extraction range (as shown in the contour range formed by the straight lines in the figure).
[0208] When the measurement type is sphericity, the sphericity calculation module calculates the sphericity as sphericity = average diameter of spherical diameter / maximum diameter of spherical diameter. The closer the sphericity value is to 1, the closer the surface is to a sphere.
[0209] When measuring sphericity, the ball diameter calculation is performed multiple times. After each calculation, the mechanism rotates a certain angle and calculates the ball diameter again to obtain a set of diameter data. The ratio of the average diameter to the maximum diameter is used as the sphericity evaluation standard.
[0210] When the measurement type is coaxiality, the coaxiality calculation module is used for calculation. The coaxiality calculation module includes
[0211] Segmentation module: used to extract the corresponding pre-processed image according to the measurement type set in the template, and evenly divide the pre-processed image into 5 segments;
[0212] Coaxiality data extraction module: used to extract the 1st and 4th sections as the coaxiality data for calculation;
[0213] Edge point data module: used to extract edge point data and obtain four groups of contour point data: L1_1, L1_2, L2_1, and L2_2;
[0214] Fitting module: used to fit the four sets of contour point data to obtain L1(x), L2(x), L3(x), and L4(x) according to the standard straight line equation;
[0215] Axis module: used to find the equations of two axes (segment 1 and segment 2) f1(x) and f2(x), making the distances between axis-L1 and axis-L2 equal. Given the expressions of L1 and L2, solve axis F1, and calculate F2 in the same way.
[0216] The distance between the two straight lines of the axes F1 and F2 represents the coaxiality in the pre-processed image.
[0217] When the measurement type is thread size and pitch, the thread pitch calculation module is used for calculation. The thread pitch calculation module includes
[0218] Edge point data extraction module: extract edge point data of the corresponding pre-processed image according to the measurement type set by the template;
[0219] Mean filter module: perform mean filtering on edge point data (determine thread peaks and valleys based on changes in curve slope, and use fuzzy processing to reduce small fluctuations to extract thread areas);
[0220] Precision segmentation module: divides edge points into several small segments according to the set detection accuracy;
[0221] Set the detection accuracy to 10 times, that is, 10 data form a small segment to calculate the slope;
[0222] Slope module: calculate the slope of each segment and extract the slope zero crossing point;
[0223] The zero crossing point is the point where the positive changes to negative or negative changes to positive, and the zero crossing point is the peak point or valley point;
[0224] Precision positioning module: Precision positioning of peak and valley positions, using the maximum and minimum values before mean filtering obtained by the mean filtering module, combined with the zero crossing point to determine the peak and valley points;
[0225] Mean calculation module: the average value of all adjacent peak-to-peak distances and valley-to-valley distances is taken as the pitch result;
[0226] Major diameter calculation module: Fitting straight lines to all peak points of the contour and the distance between the straight lines to the peak points of another contour is used as the major diameter;
[0227] Path calculation module: All valley points of the contour are fitted with straight lines, and the distance between the straight lines of valley points of another contour is calculated as the path;
[0228] Computation module: calculation;
[0229] Size diameter calculation module: Fitting straight line and calculating size diameter;
[0230] Taking all points within the range of ±0.002 of the peak and valley points, increasing the amount of data improves the accuracy of straight line fitting.
[0231] The calculation module specifically includes the following operations:
[0232] Spacing calculation module: Calculate the spacing D between the left contour and the right contour, calculate each outer diameter value every 0.1 mm in the y-axis direction, and obtain the distance set D = {D1, D2, ..., Dn};
[0233] The spacing D is the distance between the left contour point (x1 n, y1 n) and the right contour point (x2n, y2n), where the difference between y1 n and y2n is less than 0.1 mm. If the difference is greater than 0.1 mm, the next set of D is calculated;
[0234] Data filtering module: Perform median filtering and mean smoothing filtering on the data set D to obtain the data set D';
[0235] Data elimination module: take all values with odd numbers in D', and obtain D'={D1,D3,D5...Dn}. By eliminating half of the adjacent values, the influence of interference data on the number of zero crossings can be prevented;
[0236] Data difference module: perform difference processing on D' to obtain DD, DD = {D3-D1, D5-D3, ... Dn-Dn-2};
[0237] Binarization processing module: Binarize the data of DD, set the value greater than 0 to 1, and the value less than 0 to 0, and get DD';
[0238] Collection module: facilitate the data of DD' difference processing, extract the index peak y coordinate set Max with a value of -1 and the index trough y coordinate set Min with a value of 1;
[0239] Precision positioning module: Accurately locate the peak and valley coordinates of contour data;
[0240] Left contour (peak point): Taking the first peak in Max as an example, take the set P of all contour points in the Max[0] neighborhood (Max[0]-0.1, Max[0]+0.1). The point with the minimum x coordinate in P is the peak point;
[0241] Right contour (peak point): Taking the first peak in Max as an example, take the set P of all contour points in the neighborhood of Max[0] (Max[0]-0.1, Max[0]+0.1), and take the point with the maximum x coordinate in P as the peak point.
[0242] Left contour (trough point): Taking the first peak in Max as an example, take the set P of all contour points in the Max[0] neighborhood (Max[0]-0.1, Max[0]+0.1). The point with the maximum x coordinate in P is the trough point.
[0243] Right contour (trough point): Taking the first peak in Max as an example, take the set P of all contour points in the Max[0] neighborhood (Max[0]-0.1, Max[0]+0.1). The point with the minimum x coordinate in P is the trough point.
[0244] The product position detection module is used to detect the position of the product, including
[0245] Product position acquisition module: used for controlling the visual moving mechanism 41 to move the measuring head 42 to a set first position, scan a first image of the product, move the measuring head 42 to a set second position, scan a second image of the product, process and integrate the first image and the second image to obtain an initial image;
[0246] The first image scanned by the measuring head 42 at the first position is an image of one end of the product, and the second image scanned by the measuring head 42 at the second position is an image of the other end of the product;
[0247] Product position matching module: used to compare the initial image with the target position image in the template to obtain whether the initial image matches the target position image. If it matches, the gripper clamping matching module is started. If it does not match, the product centering offset module is started.
[0248] The source of the target position image in the template is: when the product is located at the set center position, the measuring head 42 is located at the first position and scans the standard first image of the product; the measuring head 42 is located at the second position and scans the standard second image of the product; the standard first image and the standard second image are processed and integrated to obtain the target position image, and the coordinates of the two ends of the product in the target position image can be obtained, and then the distances a1 and a2 between the two ends of the product and the boundary can be known. When the product is in the center position, a1=a2, and a1 and a2 are known values;
[0249] The method for determining whether the initial image matches the target position image is: obtain the coordinates of the two ends of the product in the initial image, and then obtain the distances a3 and a4 between the two ends of the product and the boundary, where a=|a1-a3|, and a is the deviation value of a1 and a3. If a is not greater than the preset deviation value threshold, it is considered that the initial image matches the target position image, and the current product is in the set center position. If a is greater than the preset deviation value threshold, it is considered that the initial image does not match the target position image, and the current product is considered to deviate from the set position.
[0250] The target position image is used to compensate for the position deviation of the product due to the loading, which causes the clamping device 5 to not fully engage with the workpiece, resulting in a position deviation of the product in space and causing a deviation in the measurement data.
[0251] Product centering deviation module: used to control the first clamping mechanism 51 or the second clamping mechanism 52 to push the product to the center position when the product is not centered;
[0252] Before starting, the first clamping jaw mechanism 51 and the second clamping jaw mechanism 52 are located at the set positions respectively, and the distances between the first clamping jaw 512 and the second clamping jaw 522 and the center of the product located at the center are preset values, namely b1 and b2 respectively. In the initial image, the coordinates of the product center are obtained according to the product length L, and then the actual distance values b3 and b4 between the first clamping jaw mechanism 51 and the second clamping jaw mechanism 52 and the center of the current product can be obtained, and the deviation between the preset value and the actual distance value can be calculated;
[0253] b5=|b1-b3|,
[0254] b6=|b2-b4|;
[0255] Determine whether b5 is greater than b6. If so, drive the second clamping mechanism 52 to move in the product direction by X, X=b3-L / 2+b1--b3=b1-L / 2; if not, drive the first clamping mechanism 51 to move in the product direction by y, y=b4-L / 2+b2--b4=b2-L / 2;
[0256] The calculation of coordinates and distances, and the calculation of two-dimensional distances and three-dimensional space distances involved in this embodiment are all conventional calculation methods, which will not be described in detail here.
[0257] The clamping matching module of the clamping jaws is used to scan and obtain the clamping image of the current product by the measuring head 42 after the clamping jaws clamp the product, match the clamping image of the current product with the clamping image of the standard product of the template, and compare the similarity between the two. If the similarity reaches a preset threshold, it is considered that the first clamping jaw 512 has clamped the product in place; if the similarity does not reach the preset threshold, it is considered that the first clamping jaw 512 has not clamped the product in place, and an alarm is issued to indicate that the product is not clamped;
[0258] The standard product clamping image is an image taken when the first clamping jaw 512 normally clamps the product;
[0259] The product size data processing module is used to calculate the size of the product outer contour data in the image. The upper computer classifies the product quality according to the size calculation results. The pre-processed images of different detection areas belong to different measurement types of products. Different measurement types of products have different size calculation methods. Specifically,
[0260] The abnormal data matching module uses the current template and the current product contour data to compare and determine whether the product-template matches. The matching algorithm draws on the FAST feature point detection algorithm and calculates the corner point features of the current product image and compares them with the corner point features in the template (generated when the template is made).
[0261] The decision tree classifies product quality based on probability. There may be abnormal results when the correct template is used due to unreasonable sample data and annotations (abnormal conditions are more likely to occur during annotation, and the decision tree only classifies similar results as abnormalities, while abnormalities during the measurement process are regarded as incorrect template use or hardware problems). By comparing the corner point features to eliminate interference, it can be determined whether the abnormal result is due to template mismatch or unqualified product size. Therefore, it is necessary to process it through the abnormal data matching module.
[0262] The abnormal data matching module includes
[0263] Abnormal data extraction module: extract the outer contour data of abnormal products: extract the contour point data set PX1 of the left contour of the product and the contour point data set PX2 of the right contour, and traverse all points in PX1 and PX2;
[0264] Corner point determination module: Corner point determination: calculate the distance between the current point and the previous point in PX1, delete it if it is less than 1mm, obtain the filtered contour point data PX1', every three adjacent points form a triangle, slide and calculate the area of the triangle, and get the area set SX1. Do the same with PX2 to get the area set SX2;
[0265] Area calculation formula: When the coordinates of the three points A, B, and C are A(x1, y1), B(x2, y2), and C(x3, y3), the area of the triangle is calculated as:
[0266] SX1=(x1y2-x1y3+x2y3-x2y1+x3y1-x2y2).
[0267] Before area calculation, determine that the length of the three sides does not exceed 2.5mm. Normally, a data point is taken every 1mm, and the longest side length is 2mm. If it exceeds 2.5mm, it is considered that the contour has a fault, and the area of the point is directly set to 0;
[0268] Corner point set module: all areas in the sets SX1 and SX2 are judged, and those larger than the threshold are regarded as corner points, and the corner point set F = {(x1, y1), ..., ((xn, yn))} is obtained;
[0269] The threshold was set to 0.25, 30°;
[0270] Template corner point set module: reads corner point information in the template file, where the corner point set in the template file is M;
[0271] Similarity calculation module: calculate the Jaccard distance (J) to determine the FM similarity ((F∩M) / (F∪M)); Note: The intersection judgment basis of the elements (corner point coordinates) in FM: the Euclidean distance is less than the threshold;
[0272] Product result judgment module: compares the similarity J with the set threshold to judge the current product measurement result;
[0273] When J (range 0-1, the closer to 1, the higher the similarity) is greater than the threshold, the current product and the measurement template match, the measurement result is valid, and the product size is unqualified; if J is less than the threshold, the product does not match the measurement template.
[0274] The decision tree creation module is used to create decision trees, including
[0275] Measurement template creation module: creates a measurement template Q, which includes measurement position information, corner point information, no decision tree node information, and no decision tree data;
[0276] Classification set creation module: input classification results to form classification set R;
[0277] The classification of the classification set R can be set as needed, for example, the simple one includes only qualified products / unqualified products, and the complex one includes high-quality products, good products, qualified products, defective products (which can be reprocessed into good products), waste products, abnormal data, etc.
[0278] The classification result is related to the standard value of each detection area of the template and the setting of each tolerance range;
[0279] Measurement result acquisition module: load template Q, start the product automatic measurement process, and obtain the measurement result set D of each product;
[0280] Manual labeling module: manually label the obtained result set D, and annotate each group of results in R according to the classification results set in step J2 to obtain the data set J;
[0281] Manually mark what category the product belongs to. For example, if the measurement result of a diameter of a product is greater than the set tolerance range but other dimensions are qualified, a category of "repair category" can be defined, which can be reprocessed to meet the requirements; for example, if a non-critical dimension of a product is unqualified, it is defined as a qualified product;
[0282] ID3 decision tree generation module: iteratively calculates and generates ID3 decision tree according to data set J and classification set R;
[0283] As mentioned above, the decision tree is a model generated based on sample data and annotation results. The ID3 decision tree generation module specifically includes:
[0284] Information entropy calculation module: calculates the information entropy of the entire data set J, that is, the sum of the information entropy of each category (measurement items in set D);
[0285] Information gain module: measure information in template Q, one measurement task is one feature, and for each feature, calculate its information gain;
[0286] Information gain is the degree to which the information entropy of the entire data set is reduced after the feature is used to divide the data set;
[0287] Dataset partitioning module: recursively calculate the information entropy of each feature, remove the selected features, select the feature with the largest information gain as the partitioning feature of the current node, and partition the data set according to the value of the feature;
[0288] Recursive module: recursively perform the above operations on each child node until all data are completely classified or the pre-set stopping condition is reached;
[0289] Information entropy calculation module: The calculation formula of information entropy is: E = -∑P(xi)*Log2(P(xi)){i = 1, 2, ... n}
[0290] P(xi) represents the probability of being classified as the i-th category when the feature is x;
[0291] The probability is the sample data and the annotation result;
[0292] When the uncertainty of the data is greater, the information entropy is also greater. When all samples belong to the same category, the information entropy is the smallest, which is 0. This means that the data set has the highest purity and the lowest degree of disorder. When the data set contains samples of different categories and the distribution is relatively uniform, the information entropy is higher and the degree of disorder of the data set is also higher.
[0293] Information writing module: writes the decision tree node-branch information into template Q, writes the data set J into the decision tree data in the template (for subsequent addition of samples and modification of decision tree nodes-branches), and the creation is completed.
[0294] The present invention realizes automatic detection of part size and automatic detection of various size types of individual parts through a shaft part measuring device, and simultaneously automatically distinguishes the quality of parts and automatically unloads materials according to the quality. Compared with the existing detection methods, the present invention greatly improves the efficiency of part detection.
[0295] Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
Claims
1. A shaft parts measurement system based on motion scanning and image acquisition, characterized in that: It includes a host computer, a slave computer, a loading device, a transmission device, a lifting device, a visual system, a clamping device, and a unloading device. The host computer controls the loading device, the transmission device, the lifting device, the visual system, the clamping device, and the unloading device through the slave computer to perform actions; the visual system collects the product outer contour image, the host computer calculates the product outer contour size according to the product outer contour image, and compares the outer contour sizes of different types with the set sizes to obtain the quality classification of the product, and the unloading device classifies the products according to the product quality classification.
2. The shaft parts measurement system based on motion scanning and image acquisition according to claim 1, characterized in that: The feeding device comprises a feeding frame, a feeding robot and a feeding position sensor. The feeding position sensor is installed on the transmission device. The feeding position sensor is used to detect whether the product is placed on the transmission device.
3. The shaft parts measurement system based on motion scanning and image acquisition according to claim 1 is characterized in that: The transmission device includes a transmission motor, a transmission frame, a transmission belt and a plurality of carrying devices. The carrying devices are distributed in an array on the transmission belt along the transmission direction of the transmission device. The transmission belt is provided with a plurality of lifting ports, which are connected up and down. The plurality of lifting ports are distributed in an array along the transmission direction of the transmission device. The carrying device includes two groups of carrying blocks, which are symmetrically distributed on both sides of the lifting ports. The two groups of carrying blocks respectively carry two ends of the product, and the middle end of the product is located above the lifting ports. The transmission frame is also provided with a detection position sensor, which is located at a set detection position. The detection position sensor is used to detect whether the product reaches the detection position.
4. The shaft parts measurement system based on motion scanning and image acquisition according to claim 1, characterized in that: The visual system includes a visual moving mechanism and a measuring head. The visual moving mechanism is connected to the frame. The visual moving mechanism is connected to the measuring head. The visual moving mechanism is set as a power drive mechanism. The movement of the measuring head is controlled by the visual moving mechanism. There are two groups of measuring heads, and the two groups of measuring heads are symmetrically arranged.
5. The shaft parts measurement system based on motion scanning and image acquisition according to claim 1 is characterized in that: The clamping device includes a first clamping mechanism and a second clamping mechanism. The first clamping mechanism and the second clamping mechanism are located in the front-to-back direction and clamp the two ends of the product respectively. The first clamping mechanism includes a first cylinder, a first clamping jaw and a first clamping jaw detection sensor. The first cylinder is fixedly connected to the frame, the first cylinder is connected to the first clamping jaw, the first clamping jaw detection sensor is connected to the first clamping jaw, and the first clamping jaw detection sensor is used to detect whether the first clamping jaw clamps the detection part. The second cylinder is fixedly connected to the frame, the second cylinder is connected to the second clamping jaw, the second clamping jaw is used to clamp the detection part, the second clamping jaw detection sensor is connected to the second clamping jaw, and the second clamping jaw detection sensor is used to detect whether the second clamping jaw clamps the detection part.
6. The shaft parts measurement system based on motion scanning and image acquisition according to claim 1, characterized in that: The host computer includes a database, a self-checking module, a data acquisition module, a system status monitoring module, a human-computer interaction module, a measurement template making module, a product size data processing module, a product position detection module, an abnormal data matching module, and a decision tree creation module.
7. The shaft parts measuring system based on motion scanning and image acquisition according to claim 6 is characterized in that: The data acquisition module is used to acquire a product outline data processing object, which is an image. The product outline data processing object is used for subsequent size calculation, specifically including: Host computer signal acquisition module: The host computer obtains the loading completion signal of the loading robot and the unloading completion signal of the unloading robot; The loading manipulator transmits the loading result and the unloading robot transmits the unloading result to the PLC. The PLC sets the loading completion and unloading completion flag registers. The host computer reads the loading and unloading status by scanning the PLC registers to obtain the loading completion signal of the loading manipulator and the unloading completion signal of the unloading robot. Motion parameter writing module: write motion parameters to PLC; Single product measurement module: used to measure a single product; Signal feedback module: used to read sensor data once the host computer receives a motion completion signal sent back by the PLC.
8. The shaft parts measurement system based on motion scanning and image acquisition according to claim 7 is characterized in that: Before the measurement starts, the overall measurement area of the single product is divided into multiple measurement areas according to the template setting requirements. After the measuring head completes the data collection of a single measurement area, the lower computer controls the motion mechanism to move the measuring head to the next measurement area, and repeats the execution to complete the surface profile data collection of the entire shaft. The single product measurement module is used for the data collection of the outer contour of a single product, specifically including: Single-area image acquisition module: After the loading device moves the product from the loading frame to the set position and clamps it, it is used to capture the image of the inspection area where the product cq is located when the measuring head moves to the qth shooting position, save the cq image, and transmit the cq image to the host computer. The number of shots P is counted + 1; The product is divided into several detection areas along its axial direction, namely c1...cq...cp. The 1st...q...pth shooting positions are set. The first shooting position corresponds to the c1 detection area...the pth shooting position corresponds to the cp detection area. q is the serial number of the current detection area, and p is the total number of the divided detection areas. Shooting counting module: used to determine whether P is less than p. If so, it is considered that the product scanning is not completed, and a motion instruction is sent to the PLC. The measuring head moves to the q+1th shooting position, and the sequence number q=q+1 is reset. The single-area image acquisition module continues to capture the next detection area image. If not, it is considered that the product scanning is completed. Image preprocessing module: used to perform preliminary processing on c1...cq...cp images to obtain preprocessed images; The c1...cq...cp images contain all the outer contour dimension data of the product. The pre-processed images of each inspection area are obtained by pre-processing the images. Size acquisition module: used to read the template detection area information and obtain the product outer contour size data contained in the pre-processed image.
9. The shaft parts measurement system based on motion scanning and image acquisition according to claim 6, characterized in that: The product size data processing module includes Line-to-line spacing calculation module: used for line-to-line spacing calculation when measuring outer diameter and height when the measurement type is outer diameter and height; Ball diameter calculation module: used to calculate the size of the ball diameter when the measurement type is ball diameter; Sphericity calculation module; used for sphericity size calculation when the measurement type is sphericity; Coaxiality calculation module: used for coaxiality dimension calculation when the measurement type is coaxiality; Thread pitch calculation module: used to calculate the thread pitch size when the measurement type is thread pitch.
10. The shaft parts measuring system based on motion scanning and image acquisition according to claim 9, characterized in that: The calculation method of the line-to-line spacing calculation module is: According to the measurement type set by the template, the edge points of the corresponding preprocessed image are extracted; the edge points are fitted to two straight lines based on the least squares method; the distance D between the two straight lines is calculated; the distance D is compared with the standard value set by the template and each tolerance range to obtain the product quality classification of the measurement type; The calculation formula for spacing D is: The line with more edge points is the target line L2, and the line with fewer edge points is the original line L1; Assume that the starting point P1 and the end point P2 of the original line L1, the starting point P3 and the end point P4 of the target line L2, the coordinates of P1, P2, P3, and P4 are known, which are P1(X1, Y1), P2(X2, Y2), P3(X3, Y3), and P4(X4, Y4), respectively. The target line is translated to the starting point P1, so that the end point P4 of the target line coincides with P1, and is set as L3. The target line is translated to the starting point P1, so that the starting point P3 of the target line coincides with P1, and is set as L4. Calculate the translation offset Lm1 between L3 and L2 and the translation offset Lm2 between L4 and L2; Lm1(X1-X4, Y1-Y4), Lm2(X1-X3, Y1-Y3); According to the translation offset, calculate the distance between the end point P3O of L3 far away from P1, the end point P4O of L4 far away from P1 and the end point P2 of L1, and select the standard line according to the distance; Coordinates of the two endpoints of L3: ([(X1, Y1), (P3OX, P3OY)]) = ([(X1, Y1), (X3+X1-X4, Y3+Y1-Y4)]); The distance d3O between P3O and the end point P2 of L1 is: Coordinates of the two end points of L4: ([(X1, Y1), (P4OX, P4OY)])===([(X1, Y1), (X4+X1-X3, Y4+Y1-Y3)]); Determine the size of d3O and d40. If d3O is less than d40, determine that the angle between L3 and L2 is an acute angle. If d3O is greater than d40, determine that the angle between L4 and L2 is an acute angle. Select the straight line with an acute angle with L2 as the standard line for subsequent calculations. The angle between L4 and L2 is an acute angle, and L4 is the standard line. Select the midpoint of the line connecting P40 of L4 and P2 of L1, connect P1 and the midpoint to obtain a parallel constraint line; The coordinates of the two end points of the parallel constraint line are [(X1, Y1), (P4OX+X2) / 2, (P4OY+Y2) / 2]; Calculate the slope k of the parallel constraint line; K=((P4OX+X2) / 2-X1) / ((P4OY+Y2) / 2-Y1) =(P4OX+X2-2X1) / (P4OY+Y2-2Y1); The parallel constraint line is translated so that the endpoint of the parallel constraint line coincides with the midpoint of L1, and the target parallel constraint line L5 is obtained; The L5 slope formula is y = kx + b, where k is the slope of the parallel constraint line; The coordinates of the midpoint of L1 are ((X1+X2) / 2), (Y1+Y2) / 2)); Therefore, b = (Y1 + Y2) / 2 - k(X1 + X2) / 2; Calculate the spacing D; The spacing D is the distance from the point to the line, that is, the distance from the midpoint of L2 to the target parallel constraint line L5; Where A=k, B=-1, C=b, (x0, y0) is the coordinate of the midpoint of L2, (x0, y0)=((X3+X4) / 2), (Y3+Y4) / 2)); We can get:
