A machine vision-based edge offset visual measurement method and image detector
Through the edge offset visual measurement method based on machine vision, a stamping sheet edge detection system is constructed, which solves the problem of real-time monitoring in stamping processing, achieves accurate detection and offset calculation of sheet edges, and improves detection efficiency. and precision.
Patent Information
- Application Number
- CN202111133008.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-09-27
AI Technical Summary
There is a lack of methods and products for real-time monitoring of the edge offset of stamping sheets during the stamping process, making it difficult to detect processing errors and potential hazards in a timely manner.
The edge offset visual measurement method based on machine vision is used to build a measurement system through a shooting unit, a control unit, a data processing unit and an algorithm recognition unit, collect standard images, extract edge feature points, calculate the offset, and realize the edge measurement of the sheet. Real-time detection.
It achieves accurate real-time monitoring of the edges of stamping sheets, can detect processing errors and potential hazards in a timely manner, and improves detection efficiency and accuracy.
Smart Images

Figure CN113870217B_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a method for visually measuring edge deviation based on machine vision and an image detector. Background Art
[0002] Stamping is a metal processing method based on the plastic deformation of metal. It uses molds and stamping equipment to apply pressure to the sheet material to make it plastically deform or separate, thereby obtaining parts with certain shapes, sizes and performance. Stamping technology occupies an important position in the manufacturing process of automobile bodies, especially large covers of automobile bodies. Most of them have complex shapes, large structural dimensions, some are spatial curved surfaces, and have high requirements for surface quality. Therefore, stamping processing methods are extremely efficient in making these parts.
[0003] The stamping process can be divided into four basic processes:
[0004] 1) Blanking: The stamping process to separate the sheet materials (including punching, blanking, trimming, cutting, etc.).
[0005] 2) Bending: A stamping process in which the sheet metal is bent into a certain angle and shape along the bending line.
[0006] 3) Drawing: A stamping process that turns flat sheet metal into various open hollow parts, or further changes the shape and size of hollow parts.
[0007] 4) Fine punching: For products with higher punching precision and products with high requirements on size and surface finish, the process of using fine punching dies to meet the requirements of the drawings is carried out.
[0008] The bending process will cause a large deformation of the stamping sheet, which requires a high degree of matching between the stamping die and the sheet. During the die repair and production process, it is helpful to detect the deviation of the sheet at each stamping at any time to analyze the working status of the bending process, so as to timely discover processing errors and potential risks.
[0009] At present, although there is a demand for real-time monitoring of the edges of stamping sheets, there is a lack of relevant real-time monitoring methods and products. Moreover, due to the working principle of stamping equipment, sensors cannot often be installed for edge detection. Therefore, there is an urgent need for a detection method and product that can effectively monitor the offset state of the sheet before and after stamping without interfering with the original stamping production line, and promptly discover processing errors and potential hidden dangers. Summary of the invention
[0010] In order to overcome the problems existing in the related art, the disclosed embodiment of the present invention provides a visual measurement method of edge offset based on machine vision, and constructs a measurement system by using this method. The technical solution is as follows:
[0011] The measurement system consists of a shooting unit, a control unit, a data processing unit, and an algorithm recognition unit; the shooting unit is used to capture images of the edges of the sheet metal in the stamping production line; the control unit is mainly a PLC control unit, which is connected to the shooting unit and is used to control the light source switch (control the on and off of the light source), shooting angle, and lens focus during image capture by the shooting unit; the data processing unit is connected to the control unit and the shooting unit and is used to store the images collected by the shooting unit and process the images, and send the image detection results or transmit information; the algorithm recognition unit is connected to the data processing unit and is used to detect and calibrate the images processed by the data processing unit to obtain the actual offset of the sheet metal during the stamping process.
[0012] The edge offset visual measurement method based on machine vision comprises the following steps:
[0013] Standard image acquisition, collecting images of products in qualified conditions;
[0014] Detection area acquisition, select the area to be detected;
[0015] Image acquisition: collecting images of products that need to be judged for edge changes;
[0016] Edge extraction: extract the edge of the product to be tested in the detection area;
[0017] Edge point extraction, extracting feature points on the edge;
[0018] Offset calculation: calculate the offset between the edge feature points of the product to be tested and the edge feature points of the standard image.
[0019] In one embodiment, standard image acquisition specifically includes the following steps:
[0020] The shooting unit includes a shooting module composed of a matrix camera and a lens, and a focusing light source module; the state of the sheet material in the mold during stamping is located in the accurate position as a comparison reference, and a standard image is obtained by taking a picture.
[0021] In one embodiment, the detection area acquisition specifically includes the following steps:
[0022] S1, select four points on the standard image and record the coordinates of the four points;
[0023] S2, use the coordinates of the four points to make a quadrilateral with the four points as vertices, and the resulting quadrilateral is the detection area.
[0024] In one embodiment, edge extraction specifically includes the following steps:
[0025] S1, extract an image containing only the detection area from the image;
[0026] S2, performing threshold segmentation processing on the image to obtain a binary image;
[0027] S3, performing morphological processing on the binary image to obtain the edge region;
[0028] S4, extracting the sub-pixel edge contour of the edge area image using a sub-pixel edge extraction operator;
[0029] S5, filtering the sub-pixel edge contour to obtain the detected edge.
[0030] In one embodiment, performing threshold segmentation processing on an image specifically includes the following steps:
[0031] S1, calculate the mean grayscale of the image within the detection area;
[0032] S2, use the mean of the image multiplied by the coefficient K to get the threshold, and the default value of K is 0.9.
[0033] In one embodiment, the binary image is subjected to morphological processing, specifically comprising the following steps:
[0034] S1, open the binary image;
[0035] S2, close the area obtained by the opening operation;
[0036] S3, disconnect the connected domain of the region obtained by the closing operation;
[0037] S4, sort the disconnected regions according to their areas;
[0038] S5, select the region with the largest area;
[0039] S6, judging whether the selected maximum area is a unique value, if so, the selection is successful;
[0040] S7, fill the blank part in the selected area;
[0041] S8, performing an expansion operation on the filled region to obtain an expanded region;
[0042] S9, performing an erosion operation on the filled area to obtain an eroded area;
[0043] S10, subtracting the expanded area from the eroded area to obtain an edge area;
[0044] S11, capturing a portion of the image that only includes the edge area.
[0045] In one embodiment, screening the sub-pixel edge contour specifically includes the following steps:
[0046] S1, obtain the length of the sub-pixel edge contour;
[0047] S2, sort the contour lengths in ascending order;
[0048] S3, select the contour corresponding to the last bit of the sequence, i.e. the longest contour, to obtain the detected edge;
[0049] S4, judging whether the selected contour is a unique value, if so, the selection is successful.
[0050] In one embodiment, edge point extraction specifically includes the following steps:
[0051] S1, make a grid that intersects horizontally and vertically within the circumscribed rectangle of the selected area;
[0052] S2, select the intersection of the contour and the grid coordinates as the feature point;
[0053] S3, records the horizontal and vertical coordinates of the feature points in the form of an array.
[0054] In one embodiment, the offset calculation specifically includes the following steps:
[0055] S1, calculating the distance between the feature point of the image to be tested and the feature point of the standard image;
[0056] S2, calculate the average of the obtained distances to obtain the pixel offset of the edge contour;
[0057] S3, actual offset = pixel offset × single pixel accuracy × calibration coefficient. Single pixel accuracy is the ratio of the camera field of view to the corresponding number of pixels. The calibration coefficient is obtained by calibrating a measuring tool with higher accuracy.
[0058] Another object of the present invention is to provide an image detector obtained according to the edge offset visual measurement method based on machine vision.
[0059] The technical solution provided by the embodiments disclosed in the present invention has the following beneficial effects:
[0060] Calculating the Euclidean distance between pixels can obtain more accurate location information between edges, while calculating the Manhattan distance between pixels is faster.
[0061] Select a standard image and extract and record the edges in the standard image. Get the offset by comparing the detected edge with the edge of the standard image, rather than setting the standard edge to a fixed value. This way, after changing to a different model of product, accurate detection can still be performed by selecting the standard image.
[0062] Multiple inspection areas can be selected for the same product at the same time to obtain product contour offset information in different inspection areas;
[0063] Selecting feature points on the edge not only reflects the location information of the edge, but also reduces the amount of calculation, shortens the detection time and improves efficiency.
[0064] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0066] Figure 1 The present invention provides a flow chart of the edge offset visual measurement method based on machine vision.
[0067] Figure 2 It is the edge detection flow chart provided by the present invention.
[0068] Figure 3 It is an image effect diagram collected by the shooting unit after the camera provided by the present invention receives a trigger signal.
[0069] Figure 4 This is a diagram showing the effect of detecting the offset of a sheet material after the stamping process provided by the present invention.
[0070] Figure 5 It is a diagram for comparing the offset of a sheet material after the stamping process provided by the present invention with the offset of a standard diagram.
[0071] Figure 6 It is a statistical diagram of the offset data of the sheet material after the stamping process provided by the present invention.
[0072] Figure 7 It is a visual measurement system diagram for constructing the edge offset visual measurement method based on machine vision provided by the present invention.
[0073] Figure 8 This is a physical structure diagram of the measurement system provided by the present invention. DETAILED DESCRIPTION
[0074] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific implementation disclosed below.
[0075] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used in the present invention are for illustrative purposes only and do not represent the only implementation method.
[0076] Unless otherwise defined, all technical and scientific terms used in the present invention have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used in the present invention in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in the present invention includes any and all combinations of one or more of the related listed items.
[0077] like Figure 1 As shown, a machine vision-based edge offset visual measurement method provided by an embodiment of the present invention comprises the following steps:
[0078] Standard image acquisition steps to capture images of products in a qualified state;
[0079] A detection area acquisition step, wherein the area to be detected is selected;
[0080] An image acquisition step is to acquire an image of the product for which edge changes need to be determined;
[0081] An edge extraction step is to extract the edge of the product to be tested in the detection area;
[0082] Edge point extraction step, extracting feature points on the edge;
[0083] The offset calculation step calculates the offset between the edge feature points of the product to be tested and the edge feature points of the standard image.
[0084] (1) Select a standard image and extract and record the edges in the standard image. The offset is obtained by comparing the detected edge with the edge of the standard image, rather than setting the standard edge to a fixed value. In this way, after replacing different models of products, accurate detection can still be performed by selecting a standard image; (2) Multiple detection areas can be selected for the same product at the same time to obtain product contour offset information in different detection areas; (3) Selecting feature points on the edge not only reflects the position information of the edge, but also reduces the amount of calculation, shortens the detection time, and improves efficiency.
[0085] The edge point extraction step specifically includes the following steps:
[0086] S1, make a grid that intersects horizontally and vertically within the circumscribed rectangle of the selected area;
[0087] S2, select the intersection of the contour and the grid coordinates as the feature point;
[0088] S3, records the horizontal and vertical coordinates of the feature points in the form of an array;
[0089] The beneficial effect is that the method of using the intersection of the contour and the grid coordinates to determine the feature point solves the problem of pixel correspondence when performing distance calculation for contours of different lengths.
[0090] The offset calculation step includes the following steps:
[0091] S1, calculating the distance between the feature point of the image to be tested and the feature point of the standard image;
[0092] S2, calculate the average of the obtained distances to obtain the pixel offset of the edge contour;
[0093] S3, actual offset = pixel offset × single pixel accuracy × calibration coefficient. Single pixel accuracy is the ratio of the camera field of view to the corresponding number of pixels. The calibration coefficient is obtained by calibration with a higher-precision measurement tool.
[0094] The technical solution of the present invention is further described below in conjunction with specific embodiments.
[0095] Example
[0096] The shooting unit includes a shooting module composed of a high-precision matrix camera and a lens. The state of the sheet metal in the mold during stamping is used as a comparison reference, and the standard image is obtained by taking pictures;
[0097] Select four points in the standard image, make a quadrilateral with the four selected points as vertices to determine the detection area, and monitor the edges in the area in real time during the subsequent stamping process. For the same model of mold, multiple detection areas can be selected for simultaneous monitoring;
[0098] Extract the edge contours within the detection area of the standard image, and then extract the feature points, and record them in the form of a coordinate array as the reference position;
[0099] After the high-precision matrix camera of the shooting module receives the trigger signal of the machine tool's mold opening and closing, it takes pictures of the sheet metal in the production process according to the trigger signal to obtain the detection image. Figure 3 That is, it is the image effect diagram collected by each mode after the camera receives the trigger signal;
[0100] Extract the contours and feature points in the detection area of the detection image, calculate the mean distance between the reference position, and obtain the offset. Figure 4 That is, the distance between the detected image feature point and the standard image feature point.
[0101] The detection area acquisition step specifically includes the following steps:
[0102] S1, select four points on the standard image and record the coordinates of the four points;
[0103] S2, use the coordinates of the four points to make a quadrilateral with the four points as vertices, and the resulting quadrilateral is the detection area;
[0104] The beneficial effect is that the method of using any four points to make a quadrilateral to obtain the detection area is more flexible and free than the standard rectangle, suitable for more types of detection edges, and reduces the interference of unnecessary non-detection areas.
[0105] Specifically, edge extraction is as follows Figure 2 As shown, the following steps are included:
[0106] S1, extract an image containing only the detection area from the image;
[0107] S2, performing threshold segmentation processing on the image to obtain a binary image;
[0108] S3, performing morphological processing on the binary image to obtain the edge region;
[0109] S4, extracting the sub-pixel edge contour of the edge area image using a sub-pixel edge extraction operator;
[0110] S5, filtering the sub-pixel edge contour to obtain the detected edge;
[0111] During the edge extraction process, (1) only the image within the detection area is processed to eliminate the interference of irrelevant areas; (2) the edge area is searched before edge extraction to narrow the extraction range and improve the extraction accuracy; (3) sub-pixel edge contour extraction makes the resolution less than one pixel and the detection accuracy reaches the sub-pixel level.
[0112] The step of screening sub-pixel edge contours specifically includes the following steps:
[0113] S1, obtain the length of the sub-pixel edge contour;
[0114] S2, sort the contour lengths in ascending order;
[0115] S3, select the contour corresponding to the last bit of the sequence, i.e. the longest contour, to obtain the detected edge;
[0116] S4, judging whether the selected contour is a unique value, if so, the selection is successful;
[0117] The beneficial effects are: the target positioning accuracy obtained by sub-pixel positioning is higher than the positioning accuracy at the whole pixel level, which improves the resolution. It is very necessary to filter according to certain rules after extracting the contours. The longest contour filtering rule greatly improves the robustness of the method.
[0118] The step of performing threshold segmentation processing on the image specifically includes the following steps:
[0119] S1, calculate the mean grayscale of the image within the detection area;
[0120] S2, the threshold is obtained by multiplying the mean of the image by the coefficient K, and the default value of K is 0.9;
[0121] The segmentation threshold is obtained by multiplying the grayscale mean of the image in the area by the coefficient K, so that the detection method can complete the contour extraction for edges of different brightness and darkness, thereby increasing the robustness of the system.
[0122] The morphological processing step of the binary image specifically includes the following steps:
[0123] S1, open the binary image;
[0124] S2, close the area obtained by the opening operation;
[0125] S3, disconnect the connected domain of the region obtained by the closing operation;
[0126] S4, sort the disconnected regions according to their areas;
[0127] S5, select the region with the largest area;
[0128] S6, judging whether the selected maximum area is a unique value, if so, the selection is successful;
[0129] S7, fill the blank part in the selected area;
[0130] S8, performing an expansion operation on the filled region to obtain an expanded region;
[0131] S9, performing an erosion operation on the filled area to obtain an eroded area;
[0132] S10, subtracting the expanded area from the eroded area to obtain an edge area;
[0133] S11, intercepting a portion of the image that only includes the edge area;
[0134] Morphological processing is performed on the binary image. (1) Open operation filters can remove isolated small dots and burrs on the edges, and disconnect areas that are still connected after binary segmentation. (2) Closed operation filters can fill small gaps and holes, while the position and shape of the area remain unchanged.
[0135] After obtaining the contour within the detection area, a grid is made that intersects horizontally and vertically within the circumscribed rectangle of the selected area, and the intersection of the contour and the grid coordinates is selected as the feature point, and the horizontal and vertical coordinates of the feature point are recorded in the form of an array;
[0136] Calculate the offset: calculate the distance between the feature point of the image to be measured and the feature point of the standard image, take the average of the obtained distances, and obtain the pixel offset of the edge contour. The actual offset = pixel offset × single pixel accuracy × calibration coefficient. Single pixel accuracy (mm / pix) = single-direction field of view size (mm) / camera single-direction resolution (pix). The calibration coefficient is obtained by calibrating a measuring tool with higher accuracy.
[0137] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
[0138] It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure should be limited by the appended claims.
Claims
1. A method for visually measuring edge offset based on machine vision, characterized in that: The edge offset visual measurement method based on machine vision comprises the following steps: Standard image acquisition, collecting images of products in qualified conditions; Detection area acquisition, select the area to be detected; Image acquisition: collecting images of products that need to be judged for edge changes; Edge extraction: extract the edge of the product to be tested in the detection area; Edge point extraction, extracting feature points on the edge; Offset calculation, calculating the offset between the edge feature points of the product to be tested and the edge feature points of the standard image; Among them, edge extraction specifically includes the following steps: S1, extract an image containing only the detection area from the image; S2, performing threshold segmentation processing on the image to obtain a binary image; S3, performing morphological processing on the binary image to obtain the edge region; S4, extracting the sub-pixel edge contour of the edge area image using a sub-pixel edge extraction operator; S5, filtering the sub-pixel edge contour to obtain the detected edge; The morphological processing of binary images specifically includes the following steps: S1, open the binary image; S2, close the area obtained by the opening operation; S3, disconnect the connected domain of the region obtained by the closing operation; S4, sort the disconnected regions according to their areas; S5, select the region with the largest area; S6, judging whether the selected maximum area is a unique value, if so, the selection is successful; S7, fill the blank part in the selected area; S8, performing an expansion operation on the filled region to obtain an expanded region; S9, performing an erosion operation on the filled area to obtain an eroded area; S10, subtracting the expanded area from the eroded area to obtain an edge area; S11, capturing a portion of the image that only includes the edge area.
2. The edge offset visual measurement method based on machine vision according to claim 1, characterized in that: Standard image acquisition, specifically including the following steps: The state in which the sheet metal is in the accurate position when the die is stamping is used as a comparison reference, and a standard image is obtained by taking a picture through a shooting unit, wherein the shooting unit includes a shooting module composed of a matrix camera and a lens, and a focusing light source module.
3. The edge offset visual measurement method based on machine vision according to claim 1, characterized in that: The detection area acquisition specifically includes the following steps: S1, select four points on the standard image and record the coordinates of the four points; S2, using the coordinates of the four points, constructs a quadrilateral with the four points as vertices, and the resulting quadrilateral is the detection area.
4. The edge offset visual measurement method based on machine vision according to claim 1, characterized in that: The image is segmented by threshold, which specifically includes the following steps: S1, calculate the mean grayscale of the image within the detection area; S2, use the mean of the image multiplied by the coefficient K to get the threshold, and the default value of K is 0.
9.
5. The edge offset visual measurement method based on machine vision according to claim 1, characterized in that: Screening sub-pixel edge contours includes the following steps: S1, obtain the length of the sub-pixel edge contour; S2, sort the contour lengths in ascending order; S3, select the contour corresponding to the last bit of the sequence, i.e. the longest contour, to obtain the detected edge; S4, judging whether the selected contour is a unique value, if so, the selection is successful.
6. The edge offset visual measurement method based on machine vision according to claim 1, characterized in that: Edge point extraction specifically includes the following steps: S1, make a grid that intersects horizontally and vertically within the circumscribed rectangle of the selected area; S2, select the intersection of the contour and the grid coordinates as the feature point; S3, records the horizontal and vertical coordinates of the feature points in the form of an array.
7. The edge offset visual measurement method based on machine vision according to claim 1, characterized in that: The offset calculation includes the following steps: S1, calculating the distance between the feature point of the image to be tested and the feature point of the standard image; S2, calculate the average of the obtained distances to obtain the pixel offset of the edge contour; S3, actual offset = pixel offset × single pixel accuracy × calibration coefficient. Single pixel accuracy is the ratio of the camera field of view to the corresponding number of pixels. The calibration coefficient is obtained by calibration with a higher precision measurement tool.
