Workpiece surface defect image detection method and system
By pre-identifying the workpiece size and center of gravity projection position, the arrangement and quantity of support frames are determined. Combined with camera scanning methods, the problem of blind spots in workpiece surface inspection is solved, achieving efficient and accurate defect identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-03-31
AI Technical Summary
Existing methods for detecting surface defects on workpieces have blind spots and operational complexity, resulting in low detection efficiency and an inability to effectively identify defects in areas obscured by the bottom of the workpiece.
By pre-identifying the workpiece size and center of gravity projection position, the arrangement and number of support frames are determined. The support frames are used to stabilize the workpiece and expose the maximum surface. Combined with camera scanning and recognition methods, defects on the upper and lower surfaces of the workpiece are identified in different areas.
It enables efficient detection of surface defects on workpieces, reduces the area obstructed by the support frame, improves detection efficiency and accuracy, and simplifies the operation process.
Smart Images

Figure CN121253546B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image detection, in particular to a workpiece surface defect image detection method and system. BACKGROUND
[0002] In the field of industrial production and manufacturing, the quality of the workpiece surface is one of the key indicators to measure the product qualification rate. Therefore, defect detection of the workpiece surface is an indispensable important link in the production process.
[0003] The widely used workpiece surface defect detection method mainly relies on the following two technical solutions. The first is the traditional manual visual detection method, which is directly held by the detection personnel, and the workpiece surface is inspected by naked eye observation or under the assistance of magnifying glass and light source. The detection efficiency is low, and the miss rate and false detection rate are high. The second is an automatic detection method based on machine vision, which usually fixes the workpiece on a specific clamp or stage, then captures the image of the exposed surface of the workpiece through the camera, and analyzes and identifies the defects by using image processing algorithm.
[0004] Since the workpiece needs to be clamped firmly by the clamp or stage for positioning, the bottom area in contact with the clamp will be blocked, resulting in a "blind area" that cannot be captured by the camera. In view of the situation of the blind area, the workpiece needs to be taken off from the clamp by the mechanical hand or manually, and then installed on the clamp again after turning over, so as to perform the second image acquisition and detection, which increases the complexity of operation and detection cycle. In order to minimize the range of blocked area and improve the efficiency of image detection, a workpiece surface defect image detection method is provided. SUMMARY
[0005] In order to improve the defect image detection efficiency of the workpiece, the present application provides a workpiece surface defect image detection method and system.
[0006] In the first aspect, the present application provides a workpiece surface defect image detection method, which adopts the following technical solution:
[0007] A workpiece surface defect image detection method, comprising:
[0008] acquiring a workpiece pre-recognition image in a preset preparation area;
[0009] identifying the workpiece from the workpiece pre-recognition image to determine the workpiece size information and the bottom flat area;
[0010] determining the workpiece gravity center projection position according to the workpiece size information;
[0011] selecting a support position and its support quantity from the bottom flat area according to the workpiece gravity center projection position and a preset support frame minimum interval distance.
[0012] generating support frame arrangement information based on the support positions and the number of supports;
[0013] arranging the support frames in the workpiece recognition area according to the support frame arrangement information, moving the workpiece from the preparation area to the workpiece recognition area and placing it on the support frames, and collecting a support form image;
[0014] adjusting the support frames according to a preset support surface adjustment method to keep the workpiece stable and expose the maximum surface based on the support form image;
[0015] detecting defects on the surface of the workpiece after the adjustment is completed.
[0016] By adopting the above technical solutions, before the surface defect detection of the workpiece, the workpiece is pre-identified to determine the support form of the support frame to the workpiece, the arrangement and number of the support frames are determined by the size of the workpiece, so that the support frames can support the workpiece with fewer numbers to ensure that the occluded area of the bottom of the workpiece is smaller, and the support stability is saved, so that the camera can detect the defect image of the upper and lower surfaces of the workpiece at one time, and the efficiency is improved.
[0017] Optionally, the support surface adjustment method comprises:
[0018] analyzing the support form image to determine the support surface projection area and the workpiece projection area;
[0019] determining the current support area of each support frame based on the support surface projection area and the number of supports;
[0020] calculating the support surface projection ratio based on the support surface projection area and the workpiece projection area;
[0021] when the support surface projection ratio exceeds a preset obstruction ratio, matching a reasonable support projection area based on the workpiece projection area;
[0022] distributing the reasonable support projection area to each support frame according to the number of supports to obtain a theoretical support area;
[0023] calculating the difference between the current support area and the theoretical support area, and defining it as a support area adjustment value;
[0024] adjusting the plurality of support units preset on the top of the support frame according to the support area adjustment value.
[0025] Optionally, the defect detection method comprises:
[0026] collecting a workpiece installation image;
[0027] A three-dimensional spatial coordinate system is established with the preset reference origin as the coordinate origin, and the coordinates of the two ends of the workpiece are identified from the workpiece installation image based on the three-dimensional spatial coordinate system.
[0028] The top-view recognition range is determined based on the coordinates of the two ends of the workpiece and the preset top angle range, and the bottom recognition range is determined based on the coordinates of the two ends of the workpiece and the preset bottom angle range.
[0029] The top-view recognition range is scanned and recognized using a preset reciprocating scanning method. After the scanning and recognition is completed, the bottom recognition range is recognized using a preset mirror recognition method.
[0030] Optional reciprocating scanning methods include:
[0031] Choose any one of the coordinates of the two ends of the workpiece as the starting scan point position;
[0032] The camera is controlled to scan in a straight line from the starting scanning point to the coordinates of the two ends of another workpiece, and then rotated by a preset circumferential angle before returning to the starting scanning point.
[0033] In the first pre-scan, the lighting panel preset on the camera is controlled at a preset unfolding angle, and the workpiece is controlled to move in the opposite direction to the camera's movement at a preset horizontal displacement speed, and the workpiece contour image is acquired.
[0034] Determine the set of contour curve coordinates from the workpiece contour image;
[0035] Fit the visible area scanning path based on the contour curve coordinate set;
[0036] The camera is controlled to perform a second fine scan of the workpiece based on the visible area scanning path and the preset recognition distance, and the surface defects of the workpiece are determined using the preset fine recognition method.
[0037] Optional, more refined identification methods include:
[0038] In the second fine scan, the shadow position points on the workpiece surface are obtained;
[0039] At the shadow location on the workpiece surface, the lighting panel is rotated by a preset rotation angle, and images of the shadow change trend are collected multiple times.
[0040] Determine the shadow length from the shadow change trend image, and determine whether the shadow length has a continuous increasing trend from the shadow change trend image;
[0041] When the shadow length has a continuous increasing trend, the workpiece is marked to have a surface protrusion. The end of the shadow that is fixed in place is determined from the shadow change trend image and defined as the location point of the surface protrusion.
[0042] Determine the current shadow length value from any image showing the shadow change trend, and match the angle position of the lighting panel based on the current shadow length value;
[0043] The height of the raised defect on the surface is determined based on the angle position of the lighting panel and the current shadow length value;
[0044] Output the location of the protrusion on the surface and the height of the protrusion defect.
[0045] Optional, also includes:
[0046] When the shadow length does not show a continuous growth trend, the workpiece is marked as having a surface depression. The type of surface depression is determined based on the shadow change trend image. The surface depression types include planar depressions and linear cracks.
[0047] Based on the planar concavity, the spray head preset in the camera is controlled to spray the shadow position points on the workpiece surface and wipe the horizontal surface of the workpiece at the shadow position points dry;
[0048] Using the shadow location on the workpiece surface as the rotation center, control the lighting panel to rotate one revolution to provide illumination and acquire multiple shadow images;
[0049] Overlay and merge all the shadow images into a single shadow-overlapping image;
[0050] Analyze the overlapping shadow image to determine the outer contour line of the shadow, and define the area enclosed by the outer contour line of the shadow as a planar concave region;
[0051] Output the surface-shaped concave area and the shadow position points on the workpiece surface.
[0052] Optional, also includes:
[0053] Based on linear cracks, the two ends of the shadow location points on the workpiece surface are determined from the shadow change trend image;
[0054] One drop of fluorescent liquid was dropped at each of the two ends, and images of the fluorescent liquid penetration were acquired.
[0055] Determine whether two drops of fluorescent liquid have fused from the fluorescent liquid penetration image;
[0056] When two drops of fluorescent liquid merge, the fluorescent liquid penetration image is analyzed to determine the fluorescent liquid penetration path;
[0057] Determining the orientation of linear cracks based on the permeation path of fluorescent liquid;
[0058] Output the direction of the linear crack and the location of the shadow on the workpiece surface.
[0059] Optional mirror recognition methods include:
[0060] Choose any one of the coordinates of the two ends of the workpiece as the starting scan point position;
[0061] The lateral movement path is determined based on the bottom recognition range and the coordinates of the two ends of the workpiece.
[0062] Control the camera to move along the lateral movement path to identify the workpiece and retrieve the camera's real-time positioning position;
[0063] Match the support frame that is closest to the camera based on the real-time positioning;
[0064] The support frame is lowered to make way for space for the camera to make identification.
[0065] Optional, also includes:
[0066] Determine the lateral recognition distance of the workpiece based on the coordinates of its two endpoints;
[0067] The workpiece lateral recognition distance is divided into several lateral recognition unit distances based on the number of supports;
[0068] The minimum descent distance of the matching support frame is based on the distance of the lateral identification unit;
[0069] The support frame is controlled to descend to the position of the minimum descent distance, and continues to descend at a preset descent speed to obtain the real-time descent distance;
[0070] The illumination brightness of the auxiliary lighting lamps preset on the top of the support frame is matched with the real-time descent distance, and the workpiece is illuminated by the auxiliary lighting lamps based on the illumination brightness.
[0071] The control camera identifies the workpiece through a recognition mirror pre-installed on the top of the support frame.
[0072] Secondly, the present invention provides a workpiece surface defect image detection system, which adopts the following technical solution:
[0073] A workpiece surface defect image detection system, comprising:
[0074] The acquisition module is used to acquire pre-identification images of the workpiece, support shape images, workpiece installation images, workpiece contour images, workpiece surface shadow position points, shadow change trend images, shadow images, and fluorescent liquid penetration images.
[0075] A memory for a program for a workpiece surface defect image detection method as described in any of the preceding claims;
[0076] The processor is a program in memory that can be loaded and executed by the processor to implement a method for detecting surface defects in a workpiece.
[0077] In summary, this application includes at least one of the following beneficial technical effects:
[0078] 1. Before performing surface defect detection on the workpiece, the workpiece is pre-identified to determine the support form of the support frame. The arrangement and number of support frames are determined by the size of the workpiece, so that the support frames can support the workpiece with a smaller number of frames to ensure that the bottom area of the workpiece is small and the support stability is maintained. This allows the camera to perform defect image detection on both the upper and lower surfaces of the workpiece at one time, improving efficiency.
[0079] 2. Since the workpiece is placed on the support frame, part of the lower surface of the workpiece is blocked. Therefore, when identifying the workpiece, the surface to be identified is divided into upper and lower parts by scanning with a camera. Each part is identified using a different identification method, thereby improving the identification efficiency of the workpiece. Attached Figure Description
[0080] Figure 1 This is a flowchart of a method for detecting surface defects on a workpiece according to an embodiment of the present invention;
[0081] Figure 2 This is a flowchart of the support surface adjustment method according to an embodiment of the present invention;
[0082] Figure 3 This is a flowchart of the defect detection method according to an embodiment of the present invention;
[0083] Figure 4 This is a flowchart of the reciprocating scanning method according to an embodiment of the present invention;
[0084] Figure 5 This is a flowchart of the mirror recognition method according to an embodiment of the present invention. Detailed Implementation
[0085] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0086] This application discloses a method for detecting surface defects on a workpiece. The method involves first positioning and mounting the workpiece onto a designated support frame of a recognition platform, and then using a camera to perform circumferential scanning and recognition, thereby detecting surface defects on the workpiece.
[0087] Reference Figure 1 A method for detecting surface defects on a workpiece includes the following steps:
[0088] Step S1: Acquire a pre-identification image of the workpiece in the preset preparation area.
[0089] The preparation area refers to the location where workpieces are stored and ready to be picked up; in an assembly line system, this is usually the end of the conveyor belt.
[0090] Workpiece pre-identification image refers to the image obtained by taking pictures of the workpiece in the preparation area through a camera set on the identification platform. This image is used to determine the basic size of the workpiece for subsequent installation and positioning.
[0091] Step S2: Identify the workpiece from the pre-identification image to determine the workpiece size information and the flat area at the bottom.
[0092] Workpiece size information refers to the basic dimensions of the workpiece to be inspected, including length, width, and height.
[0093] The flat bottom area refers to the horizontal surface position at the bottom of the workpiece.
[0094] By performing image recognition analysis on the pre-identified image of the workpiece, the size information of the workpiece in the image can be obtained. Then, based on the reference position points on the recognition platform and the image scale of the acquired image, the actual size information of the workpiece can be obtained. The flat bottom area can be obtained from the pre-identified image of the workpiece based on the horizontal plane features.
[0095] Step S3: Determine the projected position of the workpiece's center of gravity based on the workpiece's size information.
[0096] The projected position of the workpiece's center of gravity refers to the position of the workpiece's center of gravity projected onto the bottom surface of the workpiece.
[0097] In this embodiment, all workpieces are products with uniform mass distribution. Based on the above conditions, once the workpiece size information is determined, the projected position of the workpiece's center of gravity can be calculated using the workpiece size information.
[0098] Step S4: Select the support positions and the number of supports from the flat area at the bottom based on the projected position of the workpiece's center of gravity and the preset minimum interval distance of the support frame.
[0099] The minimum spacing between support frames is the minimum distance between multiple support frames used to support the workpiece on the identification platform set by the technicians, which will not be elaborated here.
[0100] The support position refers to the location on the bottom of the workpiece to be inspected that is supported by the support frame. The number of supports refers to the number of support positions.
[0101] In this embodiment, in order to support the workpiece with fewer support frames and ensure that the area of the bottom surface of the workpiece blocked by the support frames is small, while the center of gravity of the workpiece is stable and will not fall, the support frame support positions are arranged according to the above rules, thereby obtaining the support positions and the number of supports.
[0102] Step S5: Generate support frame layout information based on the support location and the number of supports.
[0103] Support frame layout information refers to the scheme for the positional distribution of support frames on the identification platform. The positions of the support frames on the identification platform are determined based on the support positions at the bottom of the workpiece. The support frame layout corresponds one-to-one with the support positions and the number of supports.
[0104] Step S6: Displace and arrange the support frame preset in the workpiece recognition area according to the support frame layout information, move the workpiece from the preparation area to the workpiece recognition area and place it on the support frame, and collect the support shape image.
[0105] The workpiece recognition area refers to the area on the recognition platform used for workpiece mounting and inspection. The workpiece recognition area has multiple movable support frames for adjusting the layout.
[0106] After the workpiece in the preparation area is first identified by image recognition to determine the support position and number of supports and generate the number of support frames, the system adjusts the layout of the support frames in the workpiece recognition area. After the layout is completed, the robot moves the workpiece from the preparation area to the workpiece recognition area and places it on the support frame.
[0107] Support morphology image refers to the image obtained by taking a picture of the bottom surface of the workpiece after it has been installed on the support frame.
[0108] Step S7: Based on the support shape image, adjust the support frame using a preset support surface adjustment method to keep the workpiece stable and expose the maximum surface.
[0109] In this embodiment, the support surface between the support frame and the workpiece is further adjusted using a support surface adjustment method to make the support surface as small as possible to expose the maximum surface area of the workpiece, thereby facilitating image detection. The support surface adjustment method will not be described in detail here, but will be described in detail in subsequent embodiments.
[0110] Step S8: After adjustment, perform defect detection on the workpiece surface.
[0111] After the support frame is adjusted a second time, the system begins to control the camera to detect surface defects on the workpiece.
[0112] Reference Figure 2 The support surface adjustment method includes the following steps:
[0113] Step S70: Analyze the support shape image to determine the projected area of the support surface and the projected area of the workpiece.
[0114] The projected area of the support surface refers to the horizontal projection area of the support surface between the support frame and the workpiece onto the recognition platform. The projected area of the workpiece refers to the horizontal projection area of the workpiece onto the recognition platform.
[0115] Both the projected area of the support surface and the projected area of the workpiece can be obtained from the image analysis of the support morphology.
[0116] Step S71: Determine the current support area of each support frame based on the projected area of the support surface and the number of supports.
[0117] In this embodiment, the area of the support surface between each support frame and the workpiece is equal. The current support area is the area of the support surface between each support frame and the workpiece.
[0118] The current support area is the quotient of the projected area of the support surface and the number of supports.
[0119] Step S72: Calculate the projection ratio of the support surface based on the projected area of the support surface and the projected area of the workpiece.
[0120] The projection ratio of the support surface refers to the proportion of the projected area of the support surface to the total projected area of the workpiece. The projection ratio of the support surface is the quotient of the projected area of the support surface and the projected area of the workpiece.
[0121] Step S73: When the proportion of the support surface projection exceeds the preset obstruction ratio, a reasonable support projection area is matched based on the workpiece projection area.
[0122] The obstruction ratio is a threshold set by the technicians for the support frame, which is unlikely to affect the percentage of the support surface projection when the camera performs image detection on the workpiece. It will not be elaborated here.
[0123] When the projection of the support surface does not exceed the obstruction ratio, it indicates that the support surface area between the support frame and the workpiece is small, and no secondary adjustment of the support frame is required.
[0124] When the projection of the support surface exceeds the obstruction ratio, it indicates that the support surface area between the support frame and the workpiece is too large. At this time, the support frame needs to be adjusted a second time to reduce the support surface area between the support frame and the workpiece.
[0125] The reasonable support projection area refers to the maximum area of the support surface when the workpiece is not easily obstructed during the inspection process. The reasonable support projection area is directly proportional to the workpiece projection area; the larger the workpiece projection area, the larger the reasonable support projection area.
[0126] Step S74: Distribute the reasonable support projection area equally to each support frame according to the number of supports to obtain the theoretical support area.
[0127] The theoretical support area refers to the theoretical support area between each support frame and the workpiece, corresponding to the reasonable support projected area. The theoretical support area is the quotient of the reasonable support projected area and the number of supports.
[0128] Step S75: Calculate the difference between the current support area and the theoretical support area, and define it as the support area adjustment value.
[0129] The support area adjustment value refers to the difference in area that needs to be adjusted between the support surface of the support frame and the workpiece. The support area adjustment value is the difference between the current support area and the theoretical support area.
[0130] Step S76: Adjust the height of multiple support units preset on the top of the support frame according to the support area adjustment value.
[0131] In this embodiment, the top of the support frame is formed by an array of multiple support units, each of which can be individually adjusted in height, and the area of each support unit is a fixed value. Once the support area adjustment value is determined, a corresponding number of support units are selected from the multiple support units, and the selected support units are lowered to detach from the bottom surface of the workpiece, thereby reducing the support area between the support frame and the workpiece.
[0132] Reference Figure 3 The defect detection method includes the following steps:
[0133] Step S80: Acquire images of the workpiece installation;
[0134] A workpiece installation image refers to an image obtained by taking a picture of the entire workpiece from above the center position of the workpiece using a camera. The overall length of the workpiece can be reflected in the workpiece installation image.
[0135] Step S81: Establish a three-dimensional spatial coordinate system with the preset reference origin as the coordinate origin, and identify the coordinates of the two end points of the workpiece from the workpiece installation image based on the three-dimensional spatial coordinate system.
[0136] The reference origin is the initial position of the camera, set by the technician. This position is located above the center of the workpiece. The robotic arm controls the camera to move and identify objects starting from the reference origin. A robotic arm is located on the worktable to move the camera.
[0137] After establishing a three-dimensional coordinate system, the position points of the camera and the workpiece surface can be mapped to coordinates, which facilitates the positioning of the position points and the movement and adjustment of the camera.
[0138] The coordinates of the two ends of the workpiece refer to the coordinate positions of the two ends of the workpiece in a three-dimensional coordinate system when the workpiece is installed on the support frame. Since the camera is located at the reference origin when it captures the image of the workpiece installation, the positional relationship between the two ends of the workpiece and the camera can be analyzed from the image. Combined with the image scale when the camera captures the image, the coordinates of the two ends of the workpiece can be determined.
[0139] Step S82: Determine the top view recognition range based on the coordinates of the two ends of the workpiece and the preset top angle range, and determine the bottom recognition range based on the coordinates of the two ends of the workpiece and the preset bottom angle range.
[0140] When a workpiece is mounted on a support frame for identification, the camera needs to scan around the workpiece's circumference 360°. Because the workpiece is supported by the frame, the camera cannot directly identify the portion of the workpiece in contact with the frame. The apex angle range is the angle range of the workpiece surface that is not obstructed by the support frame and can be directly identified by the camera. The bottom angle range is the angle range of the workpiece's bottom that abuts against the support frame and cannot be directly identified by the camera; this angle range is mainly located at the bottom of the workpiece.
[0141] The top-view recognition range is the area of the workpiece surface that can be directly recognized by the camera. Conversely, the bottom recognition range is the area that cannot be directly recognized by the camera. Both the top-view and bottom recognition ranges are curved surface areas, and the camera moves and recognizes within these curved surface areas.
[0142] The length of the arc-shaped surface region can be determined by the coordinates of the two ends of the workpiece. Then, by combining the angle range, the arc-shaped surface region can be obtained.
[0143] Step S83: Scan the top-view recognition range using a preset reciprocating scanning method. After the scanning and recognition are completed, scan the bottom recognition range using a preset mirror recognition method.
[0144] After determining the top-view recognition range and the bottom recognition range, the camera moves within the top-view recognition range and the bottom recognition range under the control of the robotic arm and recognizes the workpiece surface. The camera uses two different methods for recognition in the two areas: a reciprocating scanning method is used for recognition in the top-view recognition range, and a mirror recognition method is used for recognition in the bottom recognition range. The reciprocating scanning method and the mirror recognition method will not be described in detail here, but will be described in detail in subsequent embodiments.
[0145] Reference Figure 4 The reciprocating scanning method includes the following steps:
[0146] Step S8300: Select any one of the coordinates from the coordinates of the two ends of the workpiece as the starting scan point position.
[0147] The starting scan point is the position where the camera begins scanning the workpiece. The camera first moves from the reference origin to the coordinates of the two endpoints of the workpiece before scanning and recognizing them. Since the coordinates of the two endpoints of the workpiece include the coordinates of the first and last ends of the workpiece, the system arbitrarily selects one of the two coordinate points as the starting scan point.
[0148] Step S8301: Control the camera to scan in a straight line from the starting scanning point to the coordinates of the two ends of another workpiece, and then rotate it by a preset circumferential angle before returning to the starting scanning point.
[0149] In this embodiment, the camera first pre-scans the top-view recognition range to determine the contour of the workpiece. It then moves horizontally along a straight line from the starting scanning point to the coordinates of the two endpoints of the workpiece. Next, the robotic arm controls the camera to rotate circumferentially around the workpiece as the center. Finally, it moves horizontally back to the starting scanning point. These two linear scanning movements allow for scanning of the workpiece surface at different angles. The circumferential angle is a reference value pre-set by technicians based on the angle of the top-view recognition range and will not be elaborated upon here.
[0150] Step S8302: In the first pre-scan, the lighting panel preset on the camera is controlled at a preset unfolding angle, and the workpiece is controlled to move in the opposite direction to the camera's movement at a preset horizontal displacement speed, and the workpiece contour image is acquired.
[0151] In one embodiment, a lighting panel is provided on one side of the camera, and the lighting panel can be rotated to change the direction of illumination.
[0152] The unfolding angle is the unfolding angle of the lighting board set by the technician during the first pre-scan. At this angle, the lighting board can illuminate the surface of the workpiece, and this angle is at an angle to the direction of camera movement, which will not be elaborated here.
[0153] The horizontal displacement speed is the speed at which the camera moves horizontally and scans under the control of the robotic arm. It is preset by the technicians and will not be elaborated here.
[0154] A workpiece contour image refers to the image of the workpiece contour obtained by the camera during the first pre-scan. The camera captures multiple sets of images, which are then stitched together to obtain the final workpiece contour image.
[0155] During the first pre-scan, the camera moves along the set line and captures the outline image of the workpiece. During the movement, because the angle of the lighting panel is at an angle to the direction of the camera's movement, the lighting panel can fan the workpiece, thereby removing dust from the workpiece surface during the pre-scan and avoiding interference with the camera's recognition.
[0156] Step S8303: Determine the set of contour curve coordinates from the workpiece contour image.
[0157] The contour curve coordinate set refers to the set of all coordinates of the workpiece contour curve. From the workpiece contour image, the workpiece contour can be analyzed and identified, and its position relative to the datum origin can be obtained. After determining the position of the workpiece contour curve, the coordinates of all points on the contour curve can be determined, thus obtaining the contour curve coordinate set.
[0158] Step S8304: Fit the visible area scanning path based on the contour curve coordinate set.
[0159] The visible area scanning path refers to the movement path of the camera when it is scanning the top-view recognition range normally. The visible area scanning path is not necessarily a straight line. When the camera moves along the visible area scanning path, it can scan the entire top-view recognition range of the workpiece.
[0160] By fitting the set of contour curve coordinates using a regression equation, the scanning path of the visible area can be obtained.
[0161] Step S8305: Control the camera to perform a second fine scan of the workpiece according to the visible area scanning path and the preset recognition distance, and determine the surface defects of the workpiece using the preset fine recognition method.
[0162] The recognition distance is the distance between the camera and the workpiece surface when the camera recognizes the workpiece surface. It is preset by the technicians. At this distance, the camera can capture the clearest image, which will not be elaborated here.
[0163] After completing the first pre-scan and obtaining the visible area scanning path, the system controls the camera to perform a second fine scan of the workpiece along the visible area scanning path. During the fine scan, defects on the workpiece surface are identified. The identification is performed using a fine identification method, which will not be elaborated here but will be described in detail in subsequent embodiments.
[0164] Refined identification methods include:
[0165] Step S8310: In the second fine scan, obtain the shadow position points on the workpiece surface.
[0166] When a workpiece surface has defects, whether it's a depression or a protrusion, shadows may appear under illumination. The shadow location points on the workpiece surface refer to the coordinates of the points where shadows appear under illumination. By performing a detailed scan of the workpiece surface with a camera, the light and dark colors of the surface are identified. The darker areas are the shadow locations. After determining the shadow locations, the coordinates of these shadow locations are determined based on the current position of the camera, thus obtaining the shadow location points on the workpiece surface.
[0167] Step S8311: At the shadow position on the workpiece surface, control the rotation of the lighting panel with a preset rotation angle, and collect images of the shadow change trend multiple times.
[0168] In this embodiment, the lighting panel is rotated at the shadow position on the workpiece surface, and the form of surface defects is determined by the change in shadow.
[0169] The rotation angle is a pre-set angle by technicians for the lighting panel to illuminate the shadowed points on the workpiece surface from different angles, and will not be elaborated here.
[0170] The shadow change trend image refers to the image obtained by the camera capturing the shadow at the shadow position point on the workpiece surface during the rotation of the lighting panel. The image includes multiple pictures, each corresponding to a different angle of the lighting panel.
[0171] Step S8312: Determine the shadow length from the shadow change trend image, and determine whether the shadow length has a continuous increasing trend from the shadow change trend image.
[0172] The shadow change trend image can identify shadow features, and identifying these features allows for the determination of shadow length. During the rotation of the lighting panel, the shadow length is identified in real time to determine if it will continue to grow. Based on whether the shadow length continues to grow, the type of surface defect is distinguished. Surface defects include surface protrusions and surface depressions. For surface protrusions, the shadow length is shortest when the lighting panel is directly illuminating it, while the shadow length extends indefinitely when the illumination is perpendicular to it, during which the shadow continues to grow. For surface depressions, regardless of the angle from which the lighting panel illuminates it, the shadow is confined within the depression, therefore the shadow length does not continue to grow.
[0173] Step S8313: When the shadow length has a continuous increasing trend, mark the workpiece as having a surface protrusion, determine the fixed end of the shadow from the shadow change trend image and define it as the surface protrusion location point.
[0174] The length of the shadow is judged. If the shadow length continues to increase, the surface defect at the shadow location on the workpiece surface is a surface protrusion. After determining the surface defect type, the location is marked so that the workpiece defect problem can be displayed later.
[0175] The surface protrusion location refers to the actual coordinate position of the protrusion on the workpiece surface. The shadow location point on the workpiece surface is merely the position of the shadow, not the actual location of the surface defect. The surface protrusion location point is the end of the shadow feature that remains fixed during the change process; therefore, the surface protrusion location point can be identified and determined from the shadow change trend image.
[0176] Step S8314: Determine the current shadow length value in any shadow change trend image, and match the angle position of the lighting panel according to the current shadow length value.
[0177] The current shadow length value refers to the length of the shadow feature in any shadow change trend image. Since the lighting panel can produce shadows of different lengths when illuminated at different angles, the current shadow length value corresponds one-to-one with the angular position of the lighting panel.
[0178] Step S8315: Determine the height of the protrusion defect on the surface based on the angle position of the lighting panel and the current shadow length value.
[0179] The height of a protrusion defect refers to the height difference between a surface protrusion and the workpiece surface. Using trigonometric functions, the height of a protrusion defect can be calculated from the angular position of the lighting panel and the current shadow length.
[0180] Step S8316: Output the location of the surface protrusion and the height of the protrusion defect.
[0181] The location of the surface protrusion and the height of the protrusion defect are parameters that need to be displayed after the workpiece appearance defect identification is completed. Therefore, the location of the surface protrusion and the height of the protrusion defect are output.
[0182] The refined identification method also includes the following steps:
[0183] Step S8320: When the shadow length does not have a continuous growth trend, mark the workpiece as having a surface depression. Determine the surface depression type based on the shadow change trend image. The surface depression type includes planar depressions and linear cracks.
[0184] The length of the shadow is assessed. If the shadow length does not continue to increase, it indicates that the surface defect at the shadow location on the workpiece is a surface depression. Furthermore, identifying the shape of the surface depression from the shadow trend image allows for the determination of the depression type. Surface depression types include planar depressions and linear cracks. Planar depressions are planar in shape and have a large area. Linear cracks are cracks in the form of depressions, and the cracks are linear. Planar depressions and linear cracks differ in shape.
[0185] Step S8321: Based on the planar depression, control the spray head preset in the camera to spray the shadow position points on the workpiece surface and wipe the horizontal surface of the workpiece at the shadow position points dry.
[0186] In this embodiment, when the surface defect is determined to be a planar depression, it is ultimately necessary to determine the specific contour parameters of the planar depression. Therefore, spraying is performed on the shadowed points on the workpiece surface. After spraying, the liquid remaining on the workpiece surface is wiped dry, but the inside of the depression is not wiped dry. This causes the light reflectivity inside the depression to change due to the presence of liquid, thereby increasing the contrast between light and dark colors. The spray head is located on one side of the camera and can move synchronously with the camera to correspond to any position on the workpiece. The liquid sprayed by the spray head is an antioxidant.
[0187] Step S8322: Using the shadow position point on the workpiece surface as the rotation center, control the lighting panel to rotate one revolution to provide illumination and acquire multiple shadow images.
[0188] The shadow images here are images of the shadows inside the surface depressions. These images are captured by a camera while the lighting panel rotates around the shadow location on the workpiece surface. The shadow image consists of multiple images, each corresponding to a different angle from which the lighting panel is illuminated, and the direction of the shadow features in each image is different.
[0189] Step S8323: Overlap and merge all the shadow images into a single shadow overlap image.
[0190] A shadow overlap image is an image obtained by overlapping and merging all shadow images.
[0191] Step S8324: Analyze the shadow overlap image, determine the outer contour line of the shadow, and define the area enclosed by the outer contour line of the shadow as a planar concave region.
[0192] When all the shadow features in the shadow overlay image are superimposed, the fixed ends of each shadow feature can be connected together, thus forming a clear outline. The area inside the outline is the shadow, and the area outside the outline is the surface of the workpiece. This outline is the outer contour line of the shadow, which is also the shape outline of the planar depression. Therefore, the area enclosed by the outer contour line of the shadow is the planar depression area.
[0193] Step S8325: Output the planar concave area and the shadow position points on the workpiece surface.
[0194] The surface depression area and the shadow position point on the workpiece surface are both parameters that need to be displayed after the workpiece appearance defect identification is completed. Therefore, the surface depression area and the shadow position point on the workpiece surface are output.
[0195] The refined identification method also includes the following steps:
[0196] Step S8330: Based on the linear crack, determine the two ends of the shadow position point on the workpiece surface from the shadow change trend image.
[0197] When a surface depression is identified as a linear crack, the characteristics of the linear crack can be identified and analyzed from the shadow change trend image, which can determine the coordinates of the two ends of the linear crack on the workpiece surface.
[0198] Step S8331: Drop a drop of fluorescent liquid into each of the two ends and acquire an image of the fluorescent liquid penetration.
[0199] In this embodiment, a dropper containing fluorescent liquid is also provided on one side of the camera. Once the positions of the two ends of the linear crack are determined, the system controls the dropper to drip fluorescent liquid into the two ends respectively. Because the crack is narrow, the fluorescent liquid can quickly penetrate into the crack and move along the path of the crack.
[0200] Fluorescent liquid penetration images refer to images captured in real time by a camera when fluorescent liquid penetrates into a crack. Based on the fluorescence effect, the camera can capture the fluorescence and react in the fluorescent liquid penetration image.
[0201] When fluorescent liquid is dripped into one end of a linear crack, the camera cannot accurately determine when the fluorescent liquid reaches the other end of the crack and fills the entire crack. However, when two drops of fluorescent liquid are dripped in, the camera can quickly capture the fusion of the two drops.
[0202] Step S8332: Determine whether the two drops of fluorescent liquid have fused from the fluorescent liquid penetration image.
[0203] By capturing the fluorescence of the fluorescent liquid from the fluorescent liquid penetration image, it is possible to determine whether two drops of fluorescent liquid have fused, thereby determining whether the fluorescent liquid has filled the linear crack.
[0204] Step S8333: When the two drops of fluorescent liquid merge, analyze the fluorescent liquid penetration image to determine the fluorescent liquid penetration path.
[0205] The fluorescent liquid penetration path is the route along which the fluorescent liquid penetrates and moves within a linear crack. When two drops of fluorescent liquid merge, the entire linear crack is filled with fluorescent liquid, causing the entire crack to fluoresce in the fluorescent liquid penetration image. Therefore, the fluorescent liquid penetration path can be identified from the fluorescent liquid penetration image.
[0206] Step S8334: Determine the orientation of the linear crack based on the fluorescent liquid penetration path.
[0207] The shape of the fluorescent liquid penetration path is consistent with that of the linear crack, so the direction of the linear crack can be determined based on the fluorescent liquid penetration path.
[0208] Step S8335: Output the direction of the linear crack and the location of the shadow on the workpiece surface.
[0209] The direction of the linear crack and the location of the shadow on the workpiece surface are parameters that need to be displayed after the workpiece appearance defect identification is completed. Therefore, the direction of the linear crack and the location of the shadow on the workpiece surface are output.
[0210] Reference Figure 5 The mirror recognition method includes the following steps:
[0211] Step S8340: Select any one of the coordinates from the coordinates of the two ends of the workpiece as the starting scanning point position.
[0212] Similar to step S8300, when scanning the bottom recognition area, it is also necessary to determine the starting scan point position. After the camera completes the recognition scanning process of the top corner area, the camera is first moved to the starting scan point position.
[0213] Step S8341: Determine the lateral movement path based on the bottom recognition range and the coordinates of the two ends of the workpiece.
[0214] The lateral movement path refers to the movement path of the camera when scanning the bottom recognition area. Here, the lateral movement path is a straight line, that is, the line connecting the coordinates of the two end points of the workpiece, which is located within the bottom recognition area.
[0215] Step S8342: Control the camera to move along the lateral movement path to identify the workpiece and retrieve the real-time positioning position of the camera.
[0216] Real-time positioning refers to the camera's real-time location during movement. As the camera moves in a three-dimensional coordinate system, starting from the origin, the system records the camera's direction and distance of movement in real time, and determines the camera's current real-time positioning based on a pre-set scanning path.
[0217] Step S8343: Match the support frame that is closest to the camera based on the real-time positioning location.
[0218] In this embodiment, since the workpiece is supported by a support frame at its bottom, the support frame will block part of the workpiece, thus hindering the camera from recognizing it. Therefore, during the movement of the camera, the system will determine the nearest support frame in real time based on the real-time positioning of the camera, and then control the support frame.
[0219] Step S8344: Control the support frame to descend to make way for space for the camera to perform identification.
[0220] After identifying the corresponding support frame, the system lowers the support frame to expose the bottom of the workpiece, which was previously covered, so that the camera can identify it. The specific identification method will not be described in detail here, but will be introduced in detail in subsequent embodiments.
[0221] In this embodiment, when one of the support frames descends, the support units of the other support frames need to be adjusted simultaneously to supplement the missing support surface area of the descending support frame, so as to ensure the support stability of the workpiece.
[0222] The mirror recognition method also includes the following steps:
[0223] Step S8350: Determine the lateral recognition distance of the workpiece based on the coordinates of the two ends of the workpiece.
[0224] The lateral recognition distance of a workpiece refers to the length of the workpiece surface within the bottom recognition range that needs to be recognized along its length. Since the coordinates of the two endpoints of the workpiece are the coordinates of the two ends of the workpiece, the lateral recognition distance of the workpiece is the distance between the coordinates of the two endpoints of the workpiece.
[0225] Step S8351: Divide the workpiece lateral recognition distance into several lateral recognition unit distances according to the preset number of supports.
[0226] The number of supports refers to the number of support frames on the identification platform, which is a baseline parameter for the identification platform and will not be elaborated upon here.
[0227] In this embodiment, the workpiece is divided into multiple units of equal length, with the number of units corresponding one-to-one with the number of support frames. This allows the camera to identify a specific unit simply by lowering the support frame below that unit. The lateral identification unit distance is the length of each unit.
[0228] Step S8352: Match the minimum descent distance of the support frame according to the distance of the lateral identification unit.
[0229] In this embodiment, a recognition mirror is provided on the top of the support frame. The recognition mirror is directly facing the bottom recognition range of the workpiece. When the camera moves, it can see the bottom position of the workpiece through the recognition mirror.
[0230] In order for the camera to see the complete surface of a unit with a length equal to the horizontal recognition unit distance through the recognition mirror, there must be a certain distance between the top of the support frame and the bottom of the workpiece; this distance is called the minimum descent distance. The minimum descent distance is directly proportional to the horizontal recognition unit distance; the larger the horizontal recognition unit distance, the larger the minimum descent distance.
[0231] Step S8353: Control the support frame to descend to the position of the minimum descent distance, and continue to descend at the preset descent speed to obtain the real-time descent distance.
[0232] The descent speed is the speed at which the support frame, set by the technicians, continuously descends from the position of the minimum descent distance, and will not be elaborated here.
[0233] The real-time descent distance refers to the distance between the support frame and the bottom of the workpiece after the support frame has been continuously descending from its minimum descent distance position. The real-time descent distance can be determined based on the minimum descent distance position, the descent speed, and the continuous descent time of the support frame that the system can retrieve.
[0234] Step S8354: Match the lighting brightness of the auxiliary lighting lamp preset on the top of the support frame based on the real-time descent distance, and control the auxiliary lighting lamp to illuminate the workpiece with the lighting brightness.
[0235] The top of the support frame has an auxiliary light to illuminate the bottom of the workpiece. The farther the auxiliary light is from the bottom of the workpiece, the dimmer the bottom of the workpiece becomes. In order to ensure that the bottom of the workpiece can always maintain a brightness that is clear for the camera to recognize, the brightness of the auxiliary light needs to be adjusted.
[0236] The brightness of the auxiliary lighting is directly proportional to the real-time descent distance; the greater the real-time descent distance, the brighter the auxiliary lighting.
[0237] Step S8355: Control the camera to identify the workpiece from the recognition mirror preset on the top of the support frame.
[0238] When the camera identifies the bottom recognition range of the workpiece, it controls the corresponding support frame to descend and adjusts the brightness of the auxiliary lighting on the top of the support frame so that the bottom of the workpiece is illuminated by the auxiliary lighting. Then, the camera identifies the surface defects of the bottom recognition range of the workpiece through the recognition mirror on the top of the support frame.
[0239] Based on the same inventive concept, this application also provides a workpiece surface defect image detection system.
[0240] A workpiece surface defect image detection system includes the following modules:
[0241] The acquisition module is used to acquire pre-identification images of the workpiece, support shape images, workpiece installation images, workpiece contour images, workpiece surface shadow location points, shadow change trend images, shadow images, and fluorescent liquid penetration images.
[0242] The memory is used to store the program for a method of detecting surface defects on a workpiece.
[0243] The processor is a program in memory that can be loaded and executed by the processor to implement a method for detecting surface defects in a workpiece.
[0244] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principle of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method of detecting a surface defect image of a workpiece, characterized by, The method comprises the following steps: Collecting a pre-identification image of the workpiece in a preset preparation area; Identifying the workpiece from the pre-identification image of the workpiece to determine the size information and the flat bottom area of the workpiece; Determining the barycentric projection position of the workpiece according to the size information of the workpiece; Selecting the support position and the number of supports from the flat bottom area according to the barycentric projection position of the workpiece and the preset minimum spacing distance of the support frame; Generating support frame arrangement information based on the support position and the number of supports; Displacing and arranging the support frame preset in the workpiece identification area according to the support frame arrangement information, moving the workpiece from the preparation area to the workpiece identification area and placing it on the support frame, and collecting a support shape image, which is an image obtained by shooting the bottom surface of the workpiece through a camera after the workpiece to be detected is installed on the support frame; Adjusting the support frame by a preset support surface adjustment method based on the support shape image to keep the workpiece stable and expose the maximum surface; After the adjustment is completed, detecting defects on the surface of the workpiece; The support surface adjustment method comprises the following steps: Analyzing the support shape image to determine the support surface projection area and the workpiece projection area; Determining the current support area of each support frame based on the support surface projection area and the number of supports; Calculating the support surface projection ratio based on the support surface projection area and the workpiece projection area; When the support surface projection ratio exceeds a preset obstruction ratio, matching the reasonable support projection area based on the workpiece projection area; According to the number of supports, the reasonable support projection area is evenly distributed to each support frame to obtain a theoretical support area; Calculating the difference between the current support area and the theoretical support area, and defining it as a support area adjustment value; According to the support area adjustment value, adaptively adjust the multiple support units preset on the top of the support frame.
2. The method of claim 1, wherein The defect detection method comprises the following steps: Collecting a workpiece installation image; Establishing a space three-dimensional coordinate system with a preset reference origin as the coordinate origin, and identifying the two end point coordinates of the workpiece from the workpiece installation image according to the space three-dimensional coordinate system; Determining the overhead identification range based on the two end point coordinates of the workpiece and a preset top angle range, and determining the bottom identification range based on the two end point coordinates of the workpiece and a preset bottom angle range; Scanning and identifying the overhead identification range by a preset reciprocating scanning method, and then identifying the bottom identification range by a preset mirror surface identification method after the scanning and identification is completed.
3. The method of claim 2, wherein The reciprocating scanning method comprises the following steps: Selecting any coordinate from the two end point coordinates of the workpiece as a starting scanning point position; Controlling the camera to scan straight from the starting scanning point position to the other two end point coordinates of the workpiece, and then rotate a preset circumferential angle and return to the starting scanning point position in reverse; In the first pre-scanning, control the illumination lamp plate preset on the camera at a preset unfolding angle, control the workpiece to move in the direction opposite to the moving direction of the camera at a preset horizontal displacement speed, and collect a workpiece contour image; Determine the contour curve coordinate set from the workpiece contour image; Fit the visible area scanning path according to the contour curve coordinate set; Control the camera to perform a second fine scanning on the workpiece according to the visible area scanning path and a preset identification distance, and determine the surface defects of the workpiece by a preset fine identification method.
4. The method of claim 3, wherein The fine identification method comprises the following steps: In the second fine scanning, the shadow position point on the workpiece surface is obtained; In the shadow position point on the workpiece surface, the rotating angle of the illumination lamp plate is controlled, and the shadow change trend image is collected multiple times; The shadow length is determined from the shadow change trend image, and whether the shadow length has a continuous growth trend is determined from the shadow change trend image; When the shadow length has a continuous growth trend, it is marked that the workpiece has a surface protrusion, the shadow fixed end is determined from the shadow change trend image, and is defined as the surface protrusion position point; In any one of the shadow change trend images, the current shadow length value is determined, and the angle position of the illumination lamp plate is matched according to the current shadow length value; The protrusion defect height of the surface protrusion is determined according to the angle position of the illumination lamp plate and the current shadow length value; The surface protrusion position point and the protrusion defect height thereof are output.
5. The method of claim 4, wherein Further comprising: When the shadow length does not have a continuous growth trend, it is marked that the workpiece has a surface depression, and the surface depression type is determined according to the shadow change trend image, the surface depression type including a planar depression and a linear crack; Based on the planar depression, the spray head preset on the camera is controlled to spray the shadow position point on the workpiece surface and dry the horizontal surface of the workpiece at the shadow position point on the workpiece surface; The illumination lamp plate is controlled to rotate around the shadow position point on the workpiece surface for one revolution for illumination and collection of multiple shadow images; All the shadow images are overlapped and merged into one shadow overlap image; The shadow overlap image is analyzed to determine the shadow outer contour line, and the area surrounded by the shadow outer contour line is defined as the planar depression area; The planar depression area and the shadow position point on the workpiece surface thereof are output.
6. The method of claim 5, wherein Further comprising: Based on the linear crack, the two end position points of the shadow position point on the workpiece surface are determined from the shadow change trend image; One drop of fluorescent liquid is dropped into each of the two end position points, and a fluorescent liquid penetration image is collected; Whether the two drops of fluorescent liquid are fused is determined from the fluorescent liquid penetration image; When the two drops of fluorescent liquid are fused, the fluorescent liquid penetration path is determined by analyzing the fluorescent liquid penetration image; The linear crack direction is determined based on the fluorescent liquid penetration path; The linear crack direction and the shadow position point on the workpiece surface thereof are output.
7. The method of claim 3, wherein the method further comprises: The mirror surface recognition method comprises: An arbitrary coordinate of the two end point coordinates of the workpiece is selected as a starting scanning point position; A horizontal movement path is determined based on the bottom recognition range and the two end point coordinates of the workpiece; The camera is controlled to move along the horizontal movement path to recognize the workpiece, and the real-time positioning position of the camera is called; The support frame with the smallest distance from the camera is matched according to the real-time positioning position; The support frame is controlled to descend to avoid space for the camera to recognize.
8. The method of claim 7, wherein Further comprising: The horizontal recognition distance of the workpiece is determined based on the two end point coordinates of the workpiece; The horizontal recognition distance of the workpiece is divided into a plurality of horizontal recognition unit distances according to the number of supports; The minimum descending distance of the support frame is matched according to the horizontal recognition unit distance; The support frame is controlled to descend to the position where the minimum descending distance is located, and continuously descend at a preset descending speed to obtain a real-time descending distance; The illumination brightness of the auxiliary illumination lamp preset on the top of the support frame is matched based on the real-time descending distance, and the auxiliary illumination lamp is controlled to illuminate the workpiece at the illumination brightness; The camera is arranged in the identification mirror on the top of the support frame to identify the workpiece.
9. A workpiece surface defect image detection system, characterized by, The method comprises the following steps: The acquisition module is used for acquiring the pre-identification image of the workpiece, the support form image, the workpiece installation image, the workpiece contour image, the shadow position point of the workpiece surface, the shadow change trend image, the shadow image and the fluorescent liquid penetration image. The memory is used for storing the program of the workpiece surface defect image detection method according to any one of claims 1 to 8. The program in the memory can be loaded and executed by the processor to realize the workpiece surface defect image detection method.
Citation Information
Patent Citations
Method for detecting surface defects
CN108827971A
Integrated PCB detection machine
CN222800599U