Method and device for detecting weak defects of workpiece edge, and electronic equipment
By acquiring the contour angle information of the workpiece edge image for anomaly analysis, the problem of not being able to detect weak edge chipping, corner chipping and weak burrs in the existing technology is solved, and a high-accuracy weak defect detection is achieved.
Patent Information
- Application Number
- CN202211699991.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2042-12-28
AI Technical Summary
Existing technologies cannot effectively detect minor defects such as slight chipping, corner breakage, and burrs on the edges of workpieces, leading to inaccurate detection.
By acquiring the contour angle information of the workpiece edge image and using the anomaly analysis of the contour angle, weak defects on the workpiece edge can be detected.
It enables accurate detection of minor defects such as slight edge chipping, corner chipping, and burrs, improving detection accuracy and reducing imaging requirements.
Smart Images

Figure CN116109572B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of visual detection, and particularly relates to a detection method and device for weak defects of a workpiece edge and an electronic device. BACKGROUND
[0002] The edge of a workpiece is a contact part. In the process of machining or use, the edge is prone to defects such as edge collapse, corner collapse and burr. The defects existing in the edge will affect the assembly, use performance and service life of the workpiece.
[0003] At present, for obvious defects such as edge collapse, corner collapse and burr, defect detection is usually performed through open-close operation after image binarization. The binarization operation has certain requirements for the imaging accuracy and imaging gray scale of an industrial camera. This kind of technology cannot realize accurate detection of weak defects such as weak edge collapse, weak corner collapse and weak burr which are not obvious in imaging.
[0004] Therefore, there is an urgent need for a machine vision detection method capable of effectively detecting weak defects such as weak edge collapse, weak corner collapse and weak burr of a workpiece edge. SUMMARY
[0005] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application provides a detection method and device for weak defects of a workpiece edge and an electronic device, which can realize accurate detection of weak defects such as weak edge collapse, weak corner collapse and weak burr.
[0006] In a first aspect, the present application provides a detection method for weak defects of a workpiece edge, which comprises:
[0007] obtaining a workpiece edge image of a workpiece to be detected;
[0008] performing contour extraction based on the gray scale information of the workpiece edge image to obtain a target edge contour of the workpiece edge image;
[0009] obtaining contour angle information of the target edge contour, the contour angle information comprising angle information of each contour point in the target edge contour;
[0010] determining a weak defect detection result of the target edge contour in the workpiece to be detected based on the contour angle information.
[0011] According to the detection method for weak defects of a workpiece edge of the present application, the contour angle of the edge of the workpiece to be detected is obtained, and the obtained contour angle information is subjected to abnormal analysis of the contour angle, so that accurate detection of weak defects such as weak edge collapse, weak corner collapse and weak burr of the workpiece edge is realized, and the detection accuracy is high and the imaging requirement is low.
[0012] According to one embodiment of the present application, the determining of the weak defect detection result of the target edge profile in the workpiece to be detected based on the profile angle information comprises:
[0013] In a case where it is determined that the target edge profile has a target profile point based on the profile angle information, it is determined that the target edge profile has a weak defect;
[0014] wherein a difference between the angle information of the target profile point and the angle information of a profile point adjacent to the target profile point is greater than a first angle threshold.
[0015] According to one embodiment of the present application, the determining of the target profile point based on the profile angle information comprises:
[0016] obtaining a first angle function based on the profile angle information;
[0017] performing smoothing processing on the profile angle information, and fitting a second angle function based on the profile angle information after the smoothing processing;
[0018] obtaining at least one first closed region based on the first angle function and the second angle function;
[0019] In a case where it is determined that a region area of the first closed region is greater than a first area threshold, it is determined that a profile point in the first closed region is the target profile point.
[0020] According to one embodiment of the present application, the fitting of the second angle function based on the profile angle information after the smoothing processing comprises:
[0021] performing linear fitting or high-order fitting on the profile angle information after the smoothing processing based on an edge shape of the target edge profile, to obtain the second angle function.
[0022] According to one embodiment of the present application, the determining of the target profile point based on the profile angle information comprises:
[0023] determining that a first profile point and a second profile point which are not adjacent are the target profile point based on the profile angle information;
[0024] obtaining a first pixel distance between the first profile point and the second profile point;
[0025] In a case where it is determined that the first pixel distance exceeds a target pixel distance range, it is determined that a third profile point between the first profile point and the second profile point is the target profile point.
[0026] According to one embodiment of the present application, the profile angle information of the target edge profile is obtained by:
[0027] A first included angle is formed by connecting the fourth profile point and two fifth profile points adjacent to the fourth profile point;
[0028] A first angle bisector of the first included angle is obtained;
[0029] A first gray vector of the first angle bisector is obtained with the fourth profile point as the center;
[0030] The first gray vector is determined as the angle information of the fourth profile point.
[0031] According to one embodiment of the present application, the profile angle information of the target edge profile is obtained by:
[0032] A sixth profile point is determined as an end point of the target edge profile, and a first line segment is obtained by connecting the sixth profile point and a seventh profile point adjacent to the sixth profile point;
[0033] A vector corresponding to the perpendicular line of the first line segment is determined as the angle information of the sixth profile point.
[0034] In a second aspect, the present application provides a device for detecting weak defects of a workpiece edge, which comprises:
[0035] A first obtaining module is configured to obtain a workpiece edge image of a workpiece to be detected;
[0036] A first processing module is configured to perform profile extraction based on gray information of the workpiece edge image to obtain a target edge profile of the workpiece edge image;
[0037] A second obtaining module is configured to obtain profile angle information of the target edge profile, the profile angle information comprising angle information of each profile point in the target edge profile;
[0038] A second processing module is configured to determine a weak defect detection result of the target edge profile in the workpiece to be detected based on the profile angle information.
[0039] According to the device for detecting weak defects of a workpiece edge of the present application, the profile angle information of the workpiece edge to be detected is obtained, and the obtained profile angle information is analyzed for profile angle abnormalities, so that the weak defects such as weak edge collapse and weak burr of the workpiece edge can be accurately detected, and the detection accuracy is high and the imaging requirement is low.
[0040] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for detecting weak defects on the edge of a workpiece according to the first aspect.
[0041] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium, having a computer program stored thereon, wherein the computer program is executable by a processor to implement the method for detecting weak defects on the edge of a workpiece according to the first aspect.
[0042] In a fifth aspect, the present application provides a computer program product, comprising a computer program, wherein the computer program is executable by a processor to implement the method for detecting weak defects on the edge of a workpiece according to the first aspect.
[0043] Additional aspects and advantages of the present application will be in part apparent and in part pointed out below. BRIEF DESCRIPTION OF DRAWINGS
[0044] The above and / or additional aspects and advantages of the present application will become apparent and be readily appreciated from the following description, including the appended drawings.
[0045] Figure 1 FIG. 1 is one of flow diagrams of the method for detecting weak defects on the edge of a workpiece according to an embodiment of the present application;
[0046] Figure 2 FIG. 2 is another of flow diagrams of the method for detecting weak defects on the edge of a workpiece according to an embodiment of the present application;
[0047] Figure 3 FIG. 3 is a structural diagram of the device for detecting weak defects on the edge of a workpiece according to an embodiment of the present application;
[0048] Figure 4 FIG. 4 is a structural diagram of the electronic device according to an embodiment of the present application;
[0049] Figure 5 FIG. 5 is a hardware diagram of the electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0050] The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.
[0051] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0052] The following description, in conjunction with the accompanying drawings, details the method for detecting weak defects at the edge of a workpiece, the device for detecting weak defects at the edge of a workpiece, the electronic device, and the readable storage medium provided in this application, through specific embodiments and application scenarios.
[0053] Among them, the detection method for weak defects at the edge of the workpiece can be applied to the terminal, and can be executed by the hardware or software in the terminal.
[0054] The terminal includes, but is not limited to, portable communication devices such as mobile phones or tablets with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads).
[0055] The following embodiments describe a terminal including a display and a touch-sensitive surface. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.
[0056] The method for detecting weak defects at the edge of a workpiece provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the method for detecting weak defects at the edge of a workpiece. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, and wearable devices. The method for detecting weak defects at the edge of a workpiece provided in this application embodiment will be described below using an electronic device as the execution subject.
[0057] like Figure 1 As shown, the method for detecting weak defects at the edge of the workpiece includes steps 110, 120, 130, and 140.
[0058] Step 110: Obtain the workpiece edge image of the workpiece to be inspected.
[0059] In this step, the edge of the workpiece to be detected can be imaged by the image acquisition device to obtain a workpiece edge image.
[0060] In this embodiment, the image acquisition device can be an industrial camera.
[0061] In actual execution, the light source can be configured to provide appropriate lighting for the workpiece to be detected, and the industrial camera can be controlled to image the edge of the workpiece to be detected to obtain a workpiece edge image.
[0062] The obtained workpiece edge image of the workpiece to be detected can be a grayscale image or a color image.
[0063] In step 120, based on the grayscale information of the workpiece edge image, a contour extraction is performed to obtain a target edge contour of the workpiece edge image.
[0064] The position in the image with a sharp change in grayscale value and continuity can be defined as a contour, and the contour extraction is performed to obtain the contour in the image.
[0065] In this step, according to the grayscale information of the workpiece edge image, the contour extraction is performed, and the contour points reflecting the sharp change in grayscale value can be extracted, and these contour points are connected to obtain the target edge contour of the workpiece edge image.
[0066] It can be understood that the acquired workpiece edge image is subjected to contour extraction based on the grayscale information, and the sub-pixel contour points on the edge of the workpiece to be detected are extracted to obtain the target edge contour.
[0067] In actual execution, when the workpiece edge image is a color image, it is converted into a grayscale image, and then the contour extraction is performed based on the grayscale value of the grayscale image; when the workpiece edge image is a grayscale image, the contour extraction is directly performed based on the grayscale value of the grayscale image.
[0068] In this embodiment, the target edge contour of the workpiece to be detected can be accurately extracted based on the grayscale information of the workpiece edge image, which helps to improve the accuracy of subsequent edge defect detection of the workpiece to be detected.
[0069] In step 130, the contour angle information of the target edge contour is obtained.
[0070] The contour angle information includes the angle information of each contour point in the target edge contour.
[0071] It can be understood that the angle information of a contour point is related to the contour point and the adjacent or nearby contour points of the contour point.
[0072] The target edge contour obtained through the contour extraction is used to obtain all contour points of the target edge contour, calculate angle data of adjacent or similar contour points, and use the angle data of all contour points of the target edge contour as contour angle information of the target edge contour.
[0073] In step 140, the contour angle information is used to determine a weak defect detection result of the target edge contour in the workpiece to be detected.
[0074] In this step, the angle information of each contour point in the target edge contour is used to analyze the contour angle change on the target edge contour and determine whether there is a weak defect in the target edge contour in the workpiece to be detected.
[0075] It should be noted that the inventors of the present application found that the angle of the contour of an edge without a collapsed edge, a collapsed corner or a burr is slowly changed; the angle of the contour of an edge with a collapsed edge, a collapsed corner or a burr is greatly changed, and the angle of the contour is still relatively obvious when the defect is a weak collapsed edge, a weak collapsed corner or a weak burr.
[0076] In the embodiments of the present application, the inventors of the present application creatively convert the pixel features of the weak collapsed edge, the weak collapsed corner and the weak burr which are not easy to detect into the features of the contour angle which are obvious and easy to detect, perform abnormal analysis on the obtained contour angle information, and realize accurate detection of the weak collapsed edge, the weak collapsed corner and the weak burr of the edge of the workpiece to be detected.
[0077] It should be noted that the embodiments of the present application can accurately detect the weak collapsed edge, the weak collapsed corner and the weak burr of the edge of the workpiece to be detected, and can also accurately detect the collapsed edge, the collapsed corner and the burr of the workpiece to be detected through the change of the contour angle features.
[0078] A specific embodiment will be described below.
[0079] As shown in FIG. 1, step one is to collect an image. Figure 2
[0080] In this step, an industrial camera can be used in cooperation with a suitable light source to collect an image of the edge of the workpiece to be detected, and obtain an edge image of the workpiece.
[0081] Step two is contour extraction.
[0082] The collected edge image of the workpiece is used to extract the edge contour of the workpiece to be detected based on the gray scale information of the edge image of the workpiece, and obtain a target edge contour.
[0083] Step three is contour angle calculation.
[0084] For the target edge contour extracted by the contour extraction step, all contour points on the target edge contour are obtained, angle calculation of adjacent points is performed, and contour angle information of the target edge contour is obtained, wherein the contour angle information includes angle information of all contour points of the target edge contour.
[0085] Step four, contour angle abnormal point capture.
[0086] The contour angle information calculated by the contour angle calculation step is analyzed, and when the angle information of part of the contour points is greatly different from the angle information of adjacent contour points, the part of the contour points is determined as abnormal contour points.
[0087] Step five, edge weak defect detection.
[0088] The abnormal contour points captured by the contour angle abnormal point capture step are the defect region pixel points of the weak edge collapse and the weak burr, and according to the captured abnormal contour points, the accurate detection of the weak defects of the edge of the workpiece to be detected is completed.
[0089] According to the workpiece edge weak defect detection method provided by the embodiment of the application, by obtaining the contour angle features of the edge of the workpiece to be detected, the contour angle information obtained is analyzed for contour angle abnormalities, the accurate detection of the weak defects such as the weak edge collapse and the weak burr of the edge of the workpiece is realized, and the detection accuracy is high and the imaging requirement is low.
[0090] In some embodiments, step 140, based on the contour angle information, determining the weak defect detection result of the target edge contour in the workpiece to be detected, can include:
[0091] In the case where it is determined based on the contour angle information that the target edge contour has a target contour point, it is determined that the target edge contour has a weak defect.
[0092] The difference between the angle information of the target contour point and the angle information of the contour point adjacent to the target contour point is greater than a first angle threshold.
[0093] The target contour point is a contour point with abnormal contour angle in the target edge contour.
[0094] The difference between the angle information of the target contour point and the angle information of the contour point adjacent to the target contour point is greater than a first angle threshold, indicating that the angle information of the target contour point is greatly different from the angle information of the adjacent contour point, and the target contour point is a contour point with abnormal contour angle.
[0095] In this embodiment, according to the profile angle information of the target edge profile, each profile point in the target edge profile is analyzed, and when it is determined that there is a target profile point with abnormal profile angle in the target edge profile, the target edge profile has weak edge collapse, corner collapse or weak burr and other weak defects.
[0096] The region where the target profile point determined on the target edge profile is located is the region where the weak edge collapse, corner collapse or weak burr and other weak defects exist.
[0097] In some embodiments, based on the profile angle information, determining that the target edge profile has a target profile point can include:
[0098] Based on the profile angle information, a first angle function is obtained.
[0099] The profile angle information is smoothed, and based on the smoothed profile angle information, a second angle function is fitted.
[0100] Based on the first angle function and the second angle function, at least one first closed region is obtained.
[0101] In a case where the area of the first closed region is greater than a first area threshold, the profile point in the first closed region is determined as the target profile point.
[0102] According to the angle information of each profile point in the target edge profile, an angle function of the target edge profile is calculated, and the angle function is used to represent the angle change characteristics of the profile points of the target edge profile.
[0103] In this embodiment, based on the profile angle information, a first angle function is obtained, wherein the first angle function represents the original angle change characteristics of the target edge profile after profile extraction.
[0104] The profile angle information of the target edge profile is smoothed, and the smoothed profile angle information is fitted to obtain a second angle function, wherein the second angle function represents the smoothed angle change characteristics of the target edge profile.
[0105] According to the first angle function and the second angle function, at least one first closed region can be formed, the area of each first closed region is calculated, and when it is determined that the area of a certain first closed region is greater than a first area threshold, the profile point in the first closed region is determined as a target profile point.
[0106] In actual execution, the profile point in the first closed region can be one or more.
[0107] In some embodiments, based on the smoothed profile angle information, the second angle function can be fitted, which can include:
[0108] Based on the edge shape of the target edge contour, the smoothed contour angle information is linearly fitted or high-order fitted to obtain a second angle function.
[0109] In this embodiment, based on the edge shape of the target edge contour, linear fitting or high-order fitting is selected for fitting processing of the smoothed contour angle information to obtain a second angle function.
[0110] The fitting function form of the second angle function is determined based on the edge shape of the target edge contour. For example, when the target edge contour is a straight edge, linear fitting can be selected for fitting processing of the smoothed contour angle information.
[0111] For another example, when the target edge contour is a curved edge, high-order fitting can be selected for fitting processing of the smoothed contour angle information, and the order of the fitting function can be adjusted according to the edge shape of the target edge contour.
[0112] In some embodiments, based on the contour angle information, determining that the target edge contour has a target contour point can include:
[0113] Based on the contour angle information, determining that the first contour point and the second contour point which are not adjacent are target contour points;
[0114] Obtaining a first pixel distance between the first contour point and the second contour point;
[0115] In a case where it is determined that the first pixel distance exceeds a target pixel distance range, determining a third contour point between the first contour point and the second contour point as a target contour point.
[0116] In this embodiment, the target contour points (the first contour point and the second contour point) that have been determined are connected, the first pixel distance between the first contour point and the second contour point which are not adjacent is calculated, and when it is judged that the first pixel distance exceeds the target pixel distance range, the third contour point between the first contour point and the second contour point is determined as a target contour point, which can accurately detect the elongated edge collapse defect and improve the comprehensiveness of defect detection.
[0117] The target pixel distance range can be a pre-set pixel distance range, which can be adjusted according to the actual detection workpiece type and size.
[0118] Determining that the first pixel distance exceeds the target pixel distance range can be that the first pixel distance between the first contour point and the second contour point is greater than an upper limit value of the target pixel distance range, or that the first pixel distance between the first contour point and the second contour point is less than a lower limit value of the target pixel distance range.
[0119] In some embodiments, the step 130 of obtaining the angle information of the target edge profile can include:
[0120] connecting the fourth profile point and two fifth profile points adjacent to the fourth profile point to form a first included angle;
[0121] obtaining a first angle bisector of the first included angle;
[0122] obtaining a first gray vector of the first angle bisector with the fourth profile point as the center;
[0123] determining the first gray vector as the angle information of the fourth profile point.
[0124] In this embodiment, the fourth profile point is a profile point whose angle information is to be calculated, and the angle information of the fourth profile point is calculated according to the fourth profile point and two fifth profile points adjacent to the fourth profile point.
[0125] It should be noted that the fourth profile point is not an end point of the target edge profile, and the fourth profile point has two fifth profile points adjacent thereto.
[0126] In actual implementation, the fourth profile point whose angle is to be calculated is connected with the two fifth profile points respectively to obtain two line segments, and the two line segments form a first included angle.
[0127] After obtaining the first angle bisector of the first included angle, a first gray vector of a pixel point on the first angle bisector is calculated with the fourth profile point whose angle is to be calculated as the center, the direction of the first gray vector is taken as the angle of the fourth profile point, and the angle information of the fourth profile point is determined.
[0128] In some embodiments, the step 130 of obtaining the angle information of the target edge profile can include:
[0129] determining a sixth profile point as an end point of the target edge profile, connecting the sixth profile point and a seventh profile point adjacent to the sixth profile point to obtain a first line segment;
[0130] determining a vector corresponding to a perpendicular line of the first line segment as the angle information of the sixth profile point.
[0131] In this embodiment, the sixth profile point is a profile point whose angle information is to be calculated, and the sixth profile point is an end point of the target edge profile.
[0132] It can be understood that the sixth profile point is an end point of the target edge profile, and the seventh profile point adjacent to the sixth profile point is only one, which can be referred to as a secondary end point.
[0133] In this embodiment, the sixth profile point and the seventh profile point are connected to obtain a first line segment, that is, a line segment between the end point and the sub-end point, a perpendicular line processing is performed on the first line segment to obtain a perpendicular line of the first line segment, and a direction of a vector corresponding to the perpendicular line of the first line segment is taken as an angle of the sixth profile point of which the angle information is to be calculated, to determine the angle information of the sixth profile point.
[0134] The execution subject of the workpiece edge weak defect detection method provided in the embodiments of the present application can be a workpiece edge weak defect detection device. In the embodiments of the present application, the workpiece edge weak defect detection method is executed by the workpiece edge weak defect detection device, and the workpiece edge weak defect detection device provided in the embodiments of the present application is described.
[0135] The embodiments of the present application further provide a workpiece edge weak defect detection device.
[0136] As shown in the figure, the workpiece edge weak defect detection device comprises: Figure 3
[0137] The first acquisition module 310 is configured to acquire a workpiece edge image of a workpiece to be detected.
[0138] The first processing module 320 is configured to perform profile extraction based on the gray scale information of the workpiece edge image to obtain a target edge profile of the workpiece edge image.
[0139] The second acquisition module 330 is configured to acquire profile angle information of the target edge profile, the profile angle information comprising angle information of each profile point in the target edge profile.
[0140] The second processing module 340 is configured to determine a weak defect detection result of the target edge profile in the workpiece to be detected based on the profile angle information.
[0141] According to the workpiece edge weak defect detection device provided in the embodiments of the present application, the profile angle features of the workpiece edge to be detected are acquired, and the profile angle information obtained is subjected to abnormal analysis of the profile angle, so that the workpiece edge weak collapse, weak burr and other weak defects are accurately detected, and the detection accuracy is high and the imaging requirement is low.
[0142] In some embodiments, the second processing module 340 is configured to determine that the target edge profile has a weak defect in a case where the target edge profile has a target profile point based on the profile angle information.
[0143] The difference between the angle information of the target profile point and the angle information of the profile point adjacent to the target profile point is greater than a first angle threshold.
[0144] In some embodiments, the second processing module 340 is configured to obtain a first angle function based on the profile angle information.
[0145] smooth the contour angle information, and fit a second angle function based on the smoothed contour angle information;
[0146] obtain at least one first closed region based on the first angle function and the second angle function;
[0147] In a case where it is determined that the area of the first closed region is greater than the first area threshold, determine a contour point in the first closed region as a target contour point.
[0148] In some embodiments, the second processing module 340 is configured to perform linear fitting or high-order fitting on the smoothed contour angle information based on the edge shape of the target edge contour, to obtain the second angle function.
[0149] In some embodiments, the second processing module 340 is configured to determine, based on the contour angle information, a first contour point and a second contour point that are not adjacent as target contour points.
[0150] obtain a first pixel distance between the first contour point and the second contour point;
[0151] In a case where it is determined that the first pixel distance is out of the target pixel distance range, determine a third contour point between the first contour point and the second contour point as a target contour point.
[0152] In some embodiments, the second obtaining module 330 is configured to connect a fourth contour point and two fifth contour points adjacent to the fourth contour point to form a first included angle;
[0153] obtain a first angle bisector of the first included angle;
[0154] obtain a first gray vector of the first angle bisector with the fourth contour point as a center;
[0155] determine the first gray vector as the angle information of the fourth contour point.
[0156] In some embodiments, the second obtaining module 330 is configured to determine a sixth contour point as an end point of the target edge contour, and connect the sixth contour point and a seventh contour point adjacent to the sixth contour point to obtain a first line segment;
[0157] determine a vector corresponding to a perpendicular line of the first line segment as the angle information of the sixth contour point.
[0158] The workpiece edge weak defect detection device in the embodiments of the present applicationapplicationbe an electronic device, or a component in an electronic device, such as an integrated circuit or a chip. The electronic deviceapplicationbe a terminal or other device than a terminal. For example, the electronic deviceapplicationbe a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), andapplicationbe a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, and the like, and the embodiments of the present application do not make a specific limitation.
[0159] The workpiece edge weak defect detection device in the embodiments of the present applicationapplicationbe a device having an operating system. The operating systemapplicationbe an Android operating system, an IOS operating system, or other possible operating system, and the embodiments of the present application do not make a specific limitation.
[0160] The workpiece edge weak defect detection device provided in the embodiments of the present applicationapplicationimplement the method embodiments to achieve the various processes, and the details are not repeated here. Figures 1 to 2 The method embodimentsapplicationimplement the various processes, and the details are not repeated here.
[0161] In some embodiments, as shown in Figure 4 The embodiments of the present application also provide an electronic device 400, which includes a processor 401, a memory 402, and a computer program stored in the memory 402 and capable of running on the processor 401. The programapplicationbe executed by the processor 401 to implement the various processes of the above workpiece edge weak defect detection method embodiments and achieve the same technical effects, and the details are not repeated here.
[0162] It should be noted that the electronic device in the embodiments of the present applicationapplicationinclude the above mobile electronic device and non-mobile electronic device.
[0163] Figure 5 A hardware structure schematic diagram of an electronic device according to an embodiment of the present application.
[0164] The electronic device 500 includes, but is not limited to, a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510, and the like.
[0165] Those skilled in the art can understand that the electronic device 500 can also include a power supply (such as a battery) for powering various components, which can be logically connected to the processor 510 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device can include more or fewer components than the figure, or combine certain components, or different component arrangements, which are not described here.
[0166] The input unit 504, which is a camera in the embodiment of the present application, is used to acquire a workpiece edge image of a workpiece to be detected;
[0167] The processor 510 is used to perform contour extraction based on the gray scale information of the workpiece edge image to obtain a target edge contour of the workpiece edge image;
[0168] Obtain contour angle information of the target edge contour, and the contour angle information includes angle information of each contour point in the target edge contour;
[0169] Based on the contour angle information, determine a weak defect detection result of the target edge contour in the workpiece to be detected.
[0170] According to the electronic device provided in the embodiment of the present application, by acquiring the contour angle features of the workpiece edge to be detected, and performing abnormal analysis on the obtained contour angle information, the accurate detection of weak defects such as weak edge collapse and weak burr of the workpiece edge is realized, and the detection accuracy is high and the imaging requirement is low.
[0171] In some embodiments, the processor 510 is further configured to:
[0172] In a case where it is determined that the target edge contour has a target contour point based on the contour angle information, it is determined that the target edge contour has a weak defect;
[0173] The difference between the angle information of the target contour point and the angle information of the contour point adjacent to the target contour point is greater than a first angle threshold.
[0174] In some embodiments, the processor 510 is further configured to:
[0175] Obtain a first angle function based on the contour angle information;
[0176] Smooth the contour angle information, and fit a second angle function based on the smoothed contour angle information;
[0177] Based on the first angle function and the second angle function, at least one first closed region is obtained.
[0178] In a case where it is determined that the area of the first closed region is greater than the first area threshold, the contour point in the first closed region is determined as a target contour point.
[0179] In some embodiments, the processor 510 is further configured to:
[0180] Based on the edge shape of the target edge contour, the smoothed contour angle information is linearly fitted or high-order fitted to obtain the second angle function.
[0181] In some embodiments, the processor 510 is further configured to:
[0182] Based on the contour angle information, the first contour point and the second contour point that are not adjacent are determined as target contour points.
[0183] A first pixel distance between the first contour point and the second contour point is obtained.
[0184] In a case where it is determined that the first pixel distance exceeds the target pixel distance range, a third contour point between the first contour point and the second contour point is determined as a target contour point.
[0185] In some embodiments, the processor 510 is further configured to:
[0186] The fourth contour point and two fifth contour points adjacent to the fourth contour point are connected to form a first included angle.
[0187] A first angle bisector of the first included angle is obtained.
[0188] A first gray vector of the first angle bisector is obtained with the fourth contour point as the center.
[0189] The first gray vector is determined as the angle information of the fourth contour point.
[0190] In some embodiments, the processor 510 is further configured to:
[0191] The sixth contour point is determined as an end point of the target edge contour, and the sixth contour point and a seventh contour point adjacent to the sixth contour point are connected to obtain a first line segment.
[0192] A vector corresponding to the perpendicular line of the first line segment is determined as the angle information of the sixth contour point.
[0193] It should be understood that in the embodiments of the present application, the input unit 504 can include a graphics processing unit (GPU) 5041 and a microphone 5042. The graphics processing unit 5041 processes image data of a still picture or a video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 506 can include a display panel 5061, which can be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 507 includes at least one of a touch panel 5071 and other input devices 5072. The touch panel 5071 is also referred to as a touch screen. The touch panel 5071 can include two parts of a touch detection device and a touch controller. The other input devices 5072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), a trackball, a mouse, a joystick, and the like, which will not be described here.
[0194] The memory 509 can be used to store software programs and various data. The memory 509 can mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area can store an operating system, application programs or instructions required by at least one function (such as a sound playing function, an image playing function, etc.), and the like. In addition, the memory 509 can include a volatile memory or a non-volatile memory, or the memory 509 can include both volatile and non-volatile memories. The non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link DRAM (SLDRAM), and a direct memory bus random access memory (Direct Rambus RAM, DRRAM). The memory 509 in the embodiments of the present application includes but is not limited to these and any other suitable types of memory.
[0195] The processor 510 can include one or more processing units; the processor 510 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and an application program, and the modem processor mainly processes a wireless communication signal, such as a baseband processor. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 510.
[0196] The embodiment of the application further provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize each process of the workpiece edge weak defect detection method embodiment and achieve the same technical effect. To avoid repetition, details are not described here.
[0197] The processor is the processor in the electronic device in the above-mentioned embodiments. The readable storage medium includes a computer readable storage medium, such as a computer readable only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0198] The embodiment of the application further provides a computer program product, which includes a computer program, and the computer program is executed by a processor to realize the workpiece edge weak defect detection method.
[0199] The processor is the processor in the electronic device in the above-mentioned embodiments. The readable storage medium includes a computer readable storage medium, such as a computer readable only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0200] The embodiment of the application further provides a chip, which includes a processor and a communication interface, the communication interface is coupled with the processor, and the processor is used to run a program or an instruction to realize each process of the workpiece edge weak defect detection method embodiment and achieve the same technical effect. To avoid repetition, details are not described here.
[0201] It should be understood that the chip mentioned in the embodiment of the application can also be referred to as a system level chip, a system chip, a chip system, or a system on chip, etc.
[0202] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a", "comprising", or "comprises" does not, without more constraints, preclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element. Additionally, it should be noted that the terms "one embodiment", "some embodiments", "certain embodiments", "certain examples", or "some examples" as used in the present document are intended to refer to one or more embodiments or examples that do not necessarily have to cover all embodiments or examples of the present application. In other words, use of the above terms does not necessarily refer to the same embodiment or example. Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0203] From the above description of the embodiments, it is apparent that the above-mentioned method can be realized by means of software and necessary universal hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solution of the present application can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disc, optical disc), and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, or network equipment, etc.) execute the method described in various embodiments of the present application.
[0204] The embodiments of the present application are described above in conjunction with the drawings, but the present application is not limited to the above-mentioned specific embodiments, which are only illustrative but not restrictive, and a person of ordinary skill in the art can make many forms without departing from the purpose of the present application and the scope protected by the claims.
[0205] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "certain embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the described specific features, structures, materials or characteristics can be combined in any suitable manner in any one or more embodiments or examples.
[0206] While the embodiments of the application have been shown and described, it is to be understood that the embodiments can be varied, modified, substituted and changed by those skilled in the art without departing from the principles and spirit of the application, the scope of which is defined by the claims and their equivalents.
Claims
1. A method of detecting a weak defect of a workpiece edge, characterized by, include: Acquire the workpiece edge image of the workpiece to be inspected; Based on the grayscale information of the workpiece edge image, contour extraction is performed to obtain the target edge contour of the workpiece edge image. Obtain the contour angle information of the target edge contour, wherein the contour angle information includes the angle information of each contour point in the target edge contour; Based on the contour angle information, the detection result of weak defects in the target edge contour of the workpiece to be inspected is determined; Based on the contour angle information, the detection result of weak defects in the target edge contour of the workpiece to be inspected is determined, including: Based on the contour angle information, if it is determined that there are target contour points on the target edge contour, it is determined that there are slight defects on the target edge contour. Wherein, the difference between the angle information of the target contour point and the angle information of the contour points adjacent to the target contour point is greater than the first angle threshold; Based on the contour angle information, determining that the target edge contour contains target contour points includes: Based on the contour angle information, a first angle function is obtained; The contour angle information is smoothed, and a second angle function is fitted based on the smoothed contour angle information. Based on the first angle function and the second angle function, at least one first closed region is obtained; If the area of the first closed region is determined to be greater than the first area threshold, the contour points within the first closed region are determined as the target contour points. Alternatively, based on the contour angle information, determining that the target edge contour contains target contour points includes: Based on the contour angle information, the first and second non-adjacent contour points are determined as the target contour points; Obtain the first pixel distance between the first contour point and the second contour point; If it is determined that the first pixel distance exceeds the target pixel distance range, a third contour point between the first contour point and the second contour point is determined as the target contour point.
2. The method of claim 1, wherein The second angle function is obtained by fitting the contour angle information after smoothing, including: Based on the edge shape of the target edge contour, the smoothed contour angle information is linearly fitted or fitted at a higher order to obtain the second angle function.
3. The method of claim 1 or 2, wherein The step of obtaining the contour angle information of the target edge contour includes: Connect the fourth contour point and two fifth contour points adjacent to the fourth contour point to form a first included angle; Obtain the first angle bisector of the first included angle; Using the fourth contour point as the center, obtain the first grayscale vector of the first angle bisector; The first grayscale vector is determined as the angle information of the fourth contour point.
4. The method of claim 1 or 2, wherein The step of obtaining the contour angle information of the target edge contour includes: The sixth contour point is determined as the endpoint of the target edge contour. The sixth contour point and the seventh contour point adjacent to the sixth contour point are connected to obtain the first line segment. The vector corresponding to the perpendicular line of the first line segment is determined as the angle information of the sixth contour point.
5. A device for detecting minor defects at the edge of a workpiece, characterized in that, include: The first acquisition module is used to acquire the workpiece edge image of the workpiece to be detected; The first processing module is used to extract the contour based on the grayscale information of the workpiece edge image to obtain the target edge contour of the workpiece edge image. The second acquisition module is used to acquire the contour angle information of the target edge contour, wherein the contour angle information includes the angle information of each contour point in the target edge contour; The second processing module is used to determine the weak defect detection result of the target edge contour in the workpiece to be inspected based on the contour angle information. Based on the contour angle information, the detection result of weak defects in the target edge contour of the workpiece to be inspected is determined, including: The second processing module is used to determine that there is a slight defect in the target edge contour when it is determined that there is a target contour point based on the contour angle information. Wherein, the difference between the angle information of the target contour point and the angle information of the contour points adjacent to the target contour point is greater than the first angle threshold; The second processing module is used to obtain a first angle function based on the contour angle information; The contour angle information is smoothed, and a second angle function is fitted based on the smoothed contour angle information. Based on the first angle function and the second angle function, at least one first closed region is obtained; If the area of the first closed region is determined to be greater than the first area threshold, the contour points within the first closed region are determined as the target contour points. Alternatively, the second processing module is used to determine, based on the contour angle information, a first contour point and a second contour point that are not adjacent to each other as the target contour point; Obtain the first pixel distance between the first contour point and the second contour point; If it is determined that the first pixel distance exceeds the target pixel distance range, a third contour point between the first contour point and the second contour point is determined as the target contour point.
6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method for detecting weak defects at the edge of a workpiece as described in any one of claims 1-4.
7. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, When executed by a processor, the computer program implements the method for detecting weak defects at the edge of a workpiece as described in any one of claims 1-4.
8. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for detecting weak defects at the edge of a workpiece as described in any one of claims 1-4.
Citation Information
Patent Citations
Method and system for visual measurement of profile of machine part
CN105509653A
Wafer defect detection method and system and storage medium
CN115456977A