Cup defect detection method and system based on machine vision

The top top view detection and angle correction of the yogurt cup is performed through machine vision technology, combined with multi-view image acquisition and pneumatic elimination, which solves the problems of low efficiency and insufficient accuracy in traditional detection methods, and achieves efficient and accurate defect detection and product quality control.

CN120404776APending Publication Date: 2025-08-01JIAXING YANDANG PACKAGING
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510559704.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the production process of disposable plastic packaging containers such as yogurt cups, traditional inspection methods are inefficient and prone to missed inspections. The existing equipment cannot meet the needs of high-precision angle control and defect identification under complex backgrounds. The robotic arm removal method responds slowly and easily causes product damage.

Method used

The cup defect detection method based on machine vision is adopted to detect angle deviations through the top top view, the cup angle is corrected using PID gain parameters, the multi-view angle detection unit is activated for image acquisition, and the defective products are eliminated using a pneumatic jet sorting device.

Benefits of technology

High-precision angle correction and defect detection are achieved, ensuring product quality, improving production efficiency and product consistency, and avoiding secondary damage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120404776A_ABST
    Figure CN120404776A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machine vision, and provides a cup defect detection method and system based on machine vision. The method comprises the steps that after a cup to be detected enters a direction recognition area, an industrial camera is triggered to collect a top top view; performing angle deviation analysis based on the top view, and outputting real-time deviation; matching PID gain parameters according to the deviation; controlling the rotation angle servo driving wheel to correct the angle of the cup body by using the gain parameter until the cup leaves the direction control area; after entering a defect detection area, activating a multi-view detection unit to acquire K surface images in K directions; performing defect identification on the image to obtain a real-time result; and if the defect identification result is 1, triggering the pneumatic jet sorting device to remove the cups. The technical problem that defect detection is inaccurate due to angle deviation in the production process of the cup is solved, and the technical effects that high-precision angle correction and defect detection are conducted through the machine vision technology, and it is guaranteed that the quality of the cup is qualified in the production process are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine vision technology, and particularly to a method and system for detecting cup defects based on machine vision. Background Art

[0002] In the production process of disposable plastic packaging containers such as yogurt cups, the heat shrink packaging process is prone to defects such as deformation and wrinkles. Traditional manual inspection methods are not only inefficient but also prone to missed inspections due to visual fatigue. Most existing automated inspection devices use a fixed-station shooting method. However, due to the position offset and angle rotation of the cups during transportation, it is difficult to ensure the accuracy and stability of defect detection. Especially in the multi-faceted inspection scenario, it is necessary to ensure that a specific surface of the cup can be accurately aligned with the inspection camera, which poses higher requirements for the positioning accuracy of the cup. The current positioning method based on simple optoelectronic sensors cannot meet the high-precision angle control requirements, and ordinary image recognition algorithms also have problems with insufficient recognition rate in the context of complex packaging patterns. In addition, traditional sorting systems often use robotic arm rejection methods, which have a slow response speed and are prone to causing secondary damage to the products. Summary of the Invention

[0003] This application provides a method and system for detecting cup defects based on machine vision, aiming to solve the technical problem of inaccurate defect detection caused by angle deviation of cups during the production process.

[0004] In the first aspect disclosed in this application, a method for detecting cup defects based on machine vision is provided. The method includes: after the cup to be detected enters the direction recognition area, triggering a first industrial camera to collect a top view of the cup to be detected, where the cup to be detected is in an upside-down state; performing detection angle deviation analysis based on the top view to output a real-time angle deviation; matching PID gain parameters according to the real-time angle deviation; using the PID gain parameters to control a rotation angle servo drive wheel to perform cup body angle correction until the cup to be detected leaves the direction control area; after the cup to be detected enters the defect detection area, activating a multi-view detection unit to collect images of the cup to be detected and outputting K detection surface images corresponding to K detection directions; performing defect recognition on the K detection surface images to obtain a real-time defect recognition result; if the real-time defect recognition result is set to 1, triggering a pneumatic jet sorting device to remove the cup to be detected from the conveyor belt.

[0005] Another aspect disclosed in this application provides a cup defect detection system based on machine vision. The system includes: a top-down view module: after the area for identifying the entry direction of the cup to be detected is entered, a first industrial camera is triggered to collect a top-down view of the cup to be detected, where the cup to be detected is in an upside-down state; an angle deviation analysis module: based on the top-down view, perform detection angle deviation analysis and output the real-time angle deviation; a gain parameter matching module: match the PID gain parameters according to the real-time angle deviation; a cup body angle correction module: use the PID gain parameters to control the rotation angle servo drive wheel to perform cup body angle correction until the cup to be detected leaves the direction control area; an image acquisition module: after the cup to be detected enters the defect detection area, activate the multi-view detection unit to collect images of the cup to be detected and output K detection surface images corresponding to K detection directions; a defect identification module: perform defect identification on the K detection surface images to obtain a real-time defect identification result; a defective cup rejection module: if the real-time defect identification result is set to 1, trigger the pneumatic jet sorting device to remove the cup to be detected from the conveyor belt.

[0006] One or more technical solutions provided in this application have at least the following technical effects or advantages:

[0007] For the above-mentioned cup defect detection method based on machine vision, first, when the cup enters the direction recognition area, the first industrial camera collects its top-down view. Subsequently, through the analysis of the top-down view, the angle deviation of the cup is detected and the deviation value is output in real time. According to this deviation, the corresponding PID gain parameters are matched, and then the angle of the cup is corrected by the rotation angle servo drive wheel until the cup is in the correct direction. After that, when the cup enters the defect detection area, the multi-view detection unit is activated to collect images of the cup from multiple directions and perform defect identification. If the identification result shows a defect, the unqualified cup is removed from the conveyor belt through the pneumatic jet sorting device to ensure that only qualified products continue to flow on the production line.

[0008] The above description is only an overview of the technical solutions of this application. In order to be able to understand the technical means of this application more clearly, it can be implemented according to the content of the description. And in order to make the above and other purposes, features and advantages of this application more obvious and understandable, the specific embodiments of this application are specifically given below. Description of the Drawings

[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0010] Figure 1 It is a schematic flow chart of a cup defect detection method based on machine vision in an embodiment.

[0011] Figure 2 It is an architecture diagram of a cup defect detection system based on machine vision in an embodiment.

[0012] Explanation of reference numerals: top-down view module 11, angle deviation analysis module 12, gain parameter matching module 13, cup body angle correction module 14, image acquisition module 15, defect recognition module 16, defective cup rejection module 17. Specific implementation manners

[0013] In the embodiments of the present application, by providing a cup defect detection method and system based on machine vision, the technical problem of inaccurate defect detection caused by angle deviation during the production process of the cup is solved.

[0014] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0015] It should be noted that the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server that includes a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or modules that are not clearly listed or are inherent to these processes, methods, products or devices.

[0016] Embodiment 1, as Figure 1 shown, the present application provides a cup defect detection method based on machine vision, and the method includes:

[0017] After the cup to be detected enters the direction recognition area, trigger the first industrial camera to collect the top-down view of the cup to be detected, where the cup to be detected is in an upside-down state.

[0018] In an embodiment of the present application, when the cup to be detected (such as a disposable yogurt plastic bowl with an outer plastic package) moves into the direction recognition area, the first industrial camera will be automatically activated to start taking a top view of the cup. At this time, the cup is in an upside-down state, that is, the bottom of the cup is facing up and the mouth of the cup is facing down. This upside-down state can ensure that there are no external interfering objects on the surface of the cup during shooting, and the camera can clearly capture the angle and direction information of the cup. The taken top view will be used to analyze whether there is an angular deviation of the cup, and then determine whether angle correction is required to ensure the subsequent detection accuracy and compliance. This process is the first step in the entire detection process to ensure the direction accuracy of the cup in subsequent detections.

[0019] Based on the top view, perform detection angle deviation analysis and output the real-time angle deviation.

[0020] In one embodiment, based on the collected top view, the position and angle of the cup in the image will be analyzed. In this process, a pre-built deviation angle recognition model will be used to calculate the angle deviation of the cup relative to the standard direction. This process is completed by detecting the geometric features in the image. For example, analyze the identification points at the bottom of the cup to determine the current orientation of the cup. The calculated real-time angle deviation value will be output to provide data support for subsequent angle correction to ensure that the cup always maintains the correct direction during the production process.

[0021] Furthermore, the present application provides a method for performing detection angle deviation analysis based on the top view and outputting the real-time angle deviation, and the method includes:

[0022] Based on the top view, locate and identify the center coordinates of the cup bottom to obtain an identified top view; pre-build a deviation angle recognition model; input the identified top view into the deviation angle recognition model to perform reference angle deviation recognition and output the real-time angle deviation, where the real-time angle deviation has a deviation direction identifier.

[0023] Preferably, first, the top view is processed by an edge detection algorithm (such as Canny edge detection or Sobel operator) to identify areas with significant color changes in the image, thereby detecting the bottom edge contour of the cup. Then, a geometric algorithm is used to accurately locate the center of the cup bottom. Usually, a circular fitting algorithm (such as Hough transform) is adopted to identify whether the bottom of the cup is circular. The Hough transform can fit a circle that best conforms to the shape of the cup bottom through the edge points in the image, thereby obtaining the coordinates of the center point of the cup bottom, and thus obtaining a marked top view, which shows the exact position of the cup bottom. Subsequently, a deviation angle recognition model is pre-constructed. This model is based on the reference plastic sealing marks. The center connection lines of all reference mark points are fitted by the least squares method, and then a mark center connection line diagram is generated based on these center connection lines, and the deviation angle recognition layer is built based on this mark center connection line diagram. After that, the obtained marked top view is input into the deviation angle recognition model for analysis. The model calculates the current angle deviation value of the cup, that is, the real-time angle deviation value, by comparing the center coordinates of the cup bottom in the marked top view with the mark center connection line diagram. This real-time angle deviation value not only reflects the difference between the cup and the standard situation but also provides an indication of the deviation direction. For example, the cup is tilted to the left or right. This real-time angle deviation information will be used in subsequent angle correction steps to ensure that the cup is adjusted to the correct direction.

[0024] Furthermore, the present application provides a method for pre-constructing a deviation angle recognition model, which includes:

[0025] Extract the contour features and color features of the reference plastic sealing marks as mark recognition features; based on the mark recognition features, construct a mark positioning layer through the SIFT feature matching algorithm, where the mark positioning layer is used to locate the mark coordinates; fit the center connection lines of all reference mark points by the least squares method to generate a mark center connection line diagram; based on the mark center connection line diagram and the mark connection line engine, construct a deviation angle recognition layer; cascade the mark positioning layer and the deviation angle recognition layer to complete the construction of the deviation angle recognition model.

[0026] Optionally, first, perform contour extraction on the reference encapsulation mark. The extraction method is the same as described above. Through the extracted edge information, the contour of the mark can be obtained, and it is ensured that these features are stable and easily recognizable in different images. In addition to the contour, color information of the mark also needs to be extracted. These color information will jointly form mark recognition features with the edge contour information to improve the robustness of recognition. Subsequently, construct a mark positioning layer through the SIFT (Scale-Invariant Feature Transform) feature matching algorithm. The SIFT algorithm extracts feature descriptors with scale and rotation invariance by finding significant corner points and key points in the image. In mark recognition, SIFT features are used to match the mark in the image with the known reference mark, and the position of the mark is recognized by comparing the similarity between the two. After that, by fitting the centers of all reference mark points, use the least squares method to calculate the connecting line of all mark centers. The least squares method is a statistical method that obtains the optimal solution by minimizing the error between the actual data points and the fitted line. Here, use the least squares method to fit the center points of multiple reference marks to generate a connecting line of mark centers. This connecting line represents the comprehensive position of all marks, and the generated connecting line of mark centers will form a connecting line diagram of mark centers to provide a reference for subsequent deviation angle calculation. Then, use the connecting line diagram of mark centers and the mark connecting line engine to construct a deviation angle recognition layer to detect the deviation angle of the mark. Among them, the mark connecting line engine calculates the angle deviation by comparing the difference between the connecting line of mark centers and the actual deviation connecting line. Finally, cascade the mark positioning layer and the deviation angle recognition layer together to form a complete deviation angle recognition model. In this model, the position of the mark is recognized through the mark positioning layer, and then the angle deviation is calculated using the deviation angle recognition layer. After the two are combined, the model can accurately evaluate the position and direction deviation of the mark or the cup, provide accurate angle correction information, and provide reliable technical support for subsequent automated detection.

[0027] Furthermore, the present application provides inputting the top view of the identifier into the deviation angle recognition model to perform reference angle deviation recognition and output the real-time angle deviation. The method includes:

[0028] Input the top view of the identifier into the deviation angle recognition layer, and locate the real-time mark coordinates by comparing the mark recognition features through the SIFT feature matching algorithm; after inputting the top view of the identifier into the deviation angle recognition layer, the mark connecting line engine constructs a first deviation connecting line in the top view of the identifier according to the real-time mark coordinates and the cup bottom center coordinates; project the first deviation connecting line onto the connecting line diagram of mark centers to collect the acute angle, and output the real-time angle deviation.

[0029] Optionally, first input the identification top view into the deviation angle recognition layer. The identification top view is an image in which the center coordinates of the cup bottom have been determined through the aforementioned steps. This image contains the visual information of the cup or the mark and is the basis for subsequent deviation angle analysis. In the deviation angle recognition layer, the SIFT feature matching algorithm is used to compare the mark features in the identification top view with the features of the known mark. The SIFT algorithm realizes the matching of mark features by extracting and describing the local feature points of the mark image. Through feature matching, the real-time position of the mark in the image can be accurately identified, and the real-time mark coordinates are output. These coordinates represent the relative position of the mark in the current image. Subsequently, based on the real-time coordinates of the mark and the center coordinates of the cup bottom, the mark connection engine in the deviation angle recognition layer uses the center coordinates of the cup bottom as the starting point of the connection and the real-time coordinates of the mark as the ending point of the connection. Through simple vector calculation, a first deviation connection line is formed. This connection line represents the spatial relationship between the mark and the center point of the cup bottom and is the benchmark for angle deviation analysis. Then, project the first deviation connection line into the previously generated mark center connection diagram. This connection diagram shows the relationship between the standard position and the mark position. Through projection, the angle between the first deviation connection line and the standard connection line can be quantified. By collecting the acute angle between the projected first deviation connection line and the mark center connection diagram, the actual deviation angle can be determined. This process can be carried out through the inverse cosine function. Finally, according to the calculation result of the acute angle, the real-time angle deviation is output, indicating the deviation degree of the cup relative to the standard direction at present. This angle deviation value will provide the basis for subsequent angle correction and adjustment, ensuring that the cup can be accurately adjusted to the predetermined position, thereby improving the accuracy and robustness of the entire machine vision.

[0030] Match the PID gain parameters according to the real-time angle deviation.

[0031] In one embodiment, according to the real-time angle deviation, the calculated deviation value is matched with a pre-set sample angle deviation interval, and the most suitable PID gain parameters are selected for correction. The PID gain parameters are a set of values used to control the angle correction process of the driving wheel. They adjust the movement of the servo driving wheel according to different deviation angles. Through this matching, the parameters can be dynamically adjusted according to the current deviation situation, ensuring that the cup is accurately corrected to the standard position during the production process, thereby improving the accuracy of the overall detection and correction.

[0032] Furthermore, the present application provides a method for matching the PID gain parameters according to the real-time angle deviation, and the method includes:

[0033] Interactively obtain multiple sample PID gains for multiple sample angle deviation intervals; traverse the multiple sample angle deviation intervals with the real-time angle deviation to obtain M connected angle deviation intervals; extract M connected PID gains from the multiple sample PID gains using the M connected angle deviation intervals; smooth the M connected PID gains and output the PID gain parameters.

[0034] Preferably, first interact with the sample library to obtain multiple sample angle deviation intervals and corresponding PID gain values. Each angle deviation interval represents a specific angle range, and each interval has a matching PID gain parameter. These gain parameters are obtained based on historical data or experiments and are used for angle correction under different angle deviation intervals. Subsequently, according to the real-time angle deviation, traverse and match the multiple sample angle deviation intervals, find the M intervals involved, and use these sample angle deviation intervals as the M connected angle deviation intervals. For example, if the real-time angle deviation is 15°, the matching sample angle deviation intervals are 0° to 5°, 5° to 10°, and 10° to 15°. In this way, multi-segment PID control can be performed to achieve precise resetting and ensure that the correction of the angle deviation is neither too large nor insufficient. Then, according to the M connected angle deviation intervals, extract the corresponding PID gain values from the multiple sample PID gains as the M connected PID gains. These connected PID gains will be used for angle correction to ensure precise adjustment. Then, since there may be mutations or fluctuations in the PID gains between the angle deviation intervals, smooth processing will be performed on the M connected PID gains extracted. Smoothing usually uses weighted average or filtering algorithms to ensure smooth transition of the gain values between different angle deviation intervals and no obvious jumps. After the smoothing process, output the final PID gain parameters. These PID gain parameters will be used in the subsequent angle correction process to ensure that the angle adjustment of the cup is precise and stable, thereby improving the correction accuracy and stability.

[0035] Use the PID gain parameters to control the rotation angle servo drive wheel to perform cup body angle correction until the cup to be detected leaves the direction control area.

[0036] In one embodiment, use the matched PID gain parameters to control the movement of the rotation angle servo drive wheel. Specifically, the PID gain parameters determine which servo drive wheel on both sides of the conveyor belt starts, as well as the rotation speed and direction of the started servo drive wheel, so as to gradually adjust the angle of the cup to be detected to the correct position. When it is detected that there is an angle deviation in the cup, the servo drive wheel at the corresponding position will be started according to the PID gain parameters to precisely adjust the direction of the cup. This adjustment process will continue until the cup leaves the direction control area and enters the next detection stage.

[0037] After the cup to be detected enters the defect detection area, the multi-view detection unit is activated to collect images of the cup to be detected, and K detection surface images corresponding to K detection directions are output.

[0038] In one embodiment, when the cup to be detected enters the defect detection area, the multi-view detection unit is activated. This unit includes multiple cameras that simultaneously collect images of the cup from different angles. These cameras respectively capture images of the cup in K directions (which can be set according to the actual business) to ensure comprehensive detection of the appearance of the cup. Through the collection by the multi-view detection unit, K detection surface images in K detection directions can be obtained, providing multi-angle views for subsequent defect identification and helping to perform more accurate defect analysis.

[0039] Defect identification is performed on the K detection surface images to obtain real-time defect identification results.

[0040] In one embodiment, after obtaining the K detection surface images, the K detection surface images are combined with K sets of sample qualified images, the similarity between the K detection surface images and the K sets of sample qualified images is calculated, and then the similarity of each detection surface image is averaged and compared with the defect similarity threshold to determine whether each detection surface image is qualified. Finally, based on the similarity judgment result, a real-time defect identification result is generated. This real-time defect identification result indicates whether there are defects in the cup to be detected, providing a basis for subsequent defect rejection.

[0041] Furthermore, the present application provides a method for performing defect identification on the K detection surface images to obtain real-time defect identification results, and the method includes:

[0042] Interactively obtain K sets of sample qualified images in the K detection directions; perform histogram comparison on the K detection surface images and the K sets of sample qualified images, and output K sets of first image similarities; preset a defect similarity threshold. If all the K sets of first image similarities meet the defect similarity threshold, the real-time defect identification result is set to 0; preset a defect similarity threshold. If any one of the K sets of first image similarities does not meet the defect similarity threshold, the real-time defect identification result is set to 1.

[0043] Preferably, first interact with the sample library to obtain K sets of qualified sample images in K detection directions. These sets of qualified sample images represent the appearance of cups that meet the quality standards. The set of qualified images in each direction provides a standard reference for subsequent defect recognition. Subsequently, compare the detected surface images collected from the K detection directions with the corresponding sets of qualified sample images. Specifically, first convert the K detected surface images to be detected and the K sets of qualified sample images into grayscale images to reduce the computational complexity and improve the computational efficiency. Then, normalize the grayscale images to scale the pixel values to between 0 and 1 to eliminate the influence caused by image brightness changes. After that, according to the normalized grayscale values, draw grayscale histograms. The histogram of each image is represented as a vector, where each element represents the number of pixels at a certain gray level. Then, measure the similarity between the two histograms through histogram intersection or Bhattacharyya distance to obtain K sets of first image similarities. Each set of first image similarities represents the similarity value between a detected surface image and the corresponding qualified image. The higher the similarity value, the more similar the image to be detected is to the qualified image, and vice versa, indicating a larger difference. Then, obtain a preset defect similarity threshold. This defect similarity threshold is used to judge the degree of difference between the image to be detected and the qualified image. If all the image similarities in the K sets of first image similarities are less than this defect similarity threshold, it is considered that there is no defect, and the real-time defect recognition result is set to 0, indicating that the cup is qualified. On the contrary, if any one of the image similarities in the K sets of similarities is greater than or equal to this defect similarity threshold, it means that the image has a defect, and the real-time defect recognition result is set to 1, indicating that the cup is unqualified. In summary, through histogram comparison and similarity analysis, it is possible to judge whether the cup to be detected has a defect. If the similarity in any detection direction does not reach the threshold, the cup is judged to be unqualified. This method can effectively improve the accuracy and automation level of defect recognition, ensure that only products meeting the standards circulate on the production line, and thus greatly improve product quality and production efficiency.

[0044] Furthermore, this application also includes:

[0045] When all the K sets of first image similarities meet the defect similarity threshold, perform geometric feature matching on the K detected surface images and the K sets of qualified sample images, and output K sets of second image similarities; preset a defect compensation threshold; if any one of the image similarities in the K sets of second image similarities does not meet the defect compensation threshold, then set the real-time defect recognition result to 1.

[0046] Optionally, if all of the K first image similarity sets meet the defect similarity threshold, indicating that these images have no obvious defects, then the geometric feature matching stage will be entered. During this process, geometric feature matching will be performed on the K detected surface images and the corresponding K sets of sample qualified images. For example, the cosine similarity is used to compare the edge contour features to quantify the corresponding second image similarity, ensuring that the geometric structure and form in the image are consistent with the qualified images. Through continuous matching, K second image similarity sets will be output, indicating the matching degree of the images to be detected and the qualified images in terms of geometric features. Subsequently, the K second image similarity sets will be compared with a preset defect compensation threshold. If any one of the image similarities in the K second image similarity sets is greater than or equal to the defect compensation threshold, it indicates that the image has a defect. At this time, the real-time defect recognition result will be set to 1, indicating that the cup has a defect and does not meet the quality standard. In summary, this process further verifies the quality of the images through geometric feature matching. If the matching result does not meet the preset defect compensation threshold, it will be determined as defective, further ensuring the accuracy of defect recognition, effectively eliminating quality problems, and improving the product consistency and quality control ability in the production process.

[0047] If the real-time defect recognition result is set to 1, the pneumatic jet sorting device will be triggered to remove the cup to be detected from the conveyor belt.

[0048] In one embodiment, if a defect is found in the cup during real-time defect recognition, that is, the defect recognition result is 1), the pneumatic jet sorting device will be triggered. At this time, the pneumatic jet sorting device will blow the defective cup off the conveyor belt by means of jet airflow, separating it from other qualified cups. This process ensures that the unqualified cups are removed in a timely manner, preventing them from continuing to enter the next stage of production or packaging process, thus ensuring product quality.

[0049] In summary, the embodiments of the present application at least have the following technical effects:

[0050] In the embodiment of the present application, after the cup to be detected enters the direction recognition area, the first industrial camera is triggered to collect the top view of the cup to be detected, where the cup to be detected is in an upside-down state; then, based on the top view, the detection angle deviation is analyzed to output the real-time angle deviation, and then the PID gain parameters are matched according to the real-time angle deviation; after that, the PID gain parameters are used to control the rotation angle servo drive wheel to perform cup body angle correction until the cup to be detected leaves the direction control area; further, after the cup to be detected enters the defect detection area, the multi-view detection unit is activated to collect images of the cup to be detected, and K detection surface images corresponding to K detection directions are output; then, defect recognition is performed on the K detection surface images to obtain the real-time defect recognition result; finally, if the real-time defect recognition result is set to 1, the pneumatic injection sorting device is triggered to remove the cup to be detected from the conveyor belt. These technical effects jointly solve the technical problem of inaccurate defect detection caused by angle deviation during the production process of cups, and achieve the technical effects of high-precision angle correction and defect detection through machine vision technology, ensuring the quality qualification of cups during the production process.

[0051] Embodiment 2, based on the same inventive concept as the method for detecting cup defects based on machine vision in the foregoing embodiment, as Figure 2 shown, the present application provides a system for detecting cup defects based on machine vision, and the system includes: a top view module 11: after the cup to be detected enters the direction recognition area, the first industrial camera is triggered to collect the top view of the cup to be detected, where the cup to be detected is in an upside-down state; an angle deviation analysis module 12: based on the top view, the detection angle deviation is analyzed to output the real-time angle deviation; a gain parameter matching module 13: according to the real-time angle deviation, the PID gain parameters are matched; a cup body angle correction module 14: using the PID gain parameters to control the rotation angle servo drive wheel to perform cup body angle correction until the cup to be detected leaves the direction control area; an image acquisition module 15: after the cup to be detected enters the defect detection area, the multi-view detection unit is activated to collect images of the cup to be detected, and K detection surface images corresponding to K detection directions are output; a defect recognition module 16: defect recognition is performed on the K detection surface images to obtain the real-time defect recognition result; a defective cup removal module 17: if the real-time defect recognition result is set to 1, the pneumatic injection sorting device is triggered to remove the cup to be detected from the conveyor belt.

[0052] Further, the angle deviation analysis module 12 is further used to execute the following method:

[0053] Locate and identify the center coordinates of the cup bottom based on the top view to obtain an identified top view; pre-construct a deviation angle recognition model; input the identified top view into the deviation angle recognition model to perform reference angle deviation recognition and output the real-time angle deviation, where the real-time angle deviation has a deviation direction identifier.

[0054] Further, the angle deviation analysis module 12 is further configured to execute the following method:

[0055] Extract the contour features and color features of the reference plastic seal mark as mark recognition features; based on the mark recognition features, construct a mark positioning layer through the SIFT feature matching algorithm, where the mark positioning layer is used to locate the mark coordinates; fit the center connection lines of all reference mark points by the least square method to generate a mark center connection line diagram; construct a deviation angle recognition layer based on the mark center connection line diagram and the mark connection line engine; cascade the mark positioning layer and the deviation angle recognition layer to complete the construction of the deviation angle recognition model.

[0056] Further, the angle deviation analysis module 12 is further configured to execute the following method:

[0057] Input the identified top view into the deviation angle recognition layer, and compare the mark recognition features through the SIFT feature matching algorithm to locate the real-time mark coordinates; after inputting the identified top view into the deviation angle recognition layer, the mark connection line engine constructs a first deviation connection line in the identified top view according to the real-time mark coordinates and the cup bottom center coordinates; project the first deviation connection line onto the mark center connection line diagram to collect the acute angle and output the real-time angle deviation.

[0058] Further, the gain parameter matching module 13 is further configured to execute the following method:

[0059] Interactively obtain multiple sample PID gains for multiple sample angle deviation intervals; traverse the multiple sample angle deviation intervals with the real-time angle deviation to obtain M connected angle deviation intervals; extract M connected PID gains from the multiple sample PID gains using the M connected angle deviation intervals; smooth the M connected PID gains and output the PID gain parameter.

[0060] Further, the defect recognition module 16 is further configured to execute the following method:

[0061] Interactively obtain K sets of sample qualified images for the K detection directions; perform histogram comparison on the K detection surface images and the K sets of sample qualified images, and output K sets of first image similarity; preset a defect similarity threshold. If all the K sets of first image similarity meet the defect similarity threshold, set the real-time defect recognition result to 0; preset a defect similarity threshold. If any one of the image similarities in the K sets of first image similarity does not meet the defect similarity threshold, set the real-time defect recognition result to 1.

[0062] Further, the defect recognition module 16 is further configured to execute the following method:

[0063] When all the K sets of first image similarity meet the defect similarity threshold, perform geometric feature matching on the K detection surface images and the K sets of sample qualified images, and output K sets of second image similarity; preset a defect compensation threshold; if any one of the image similarities in the K sets of second image similarity does not meet the defect compensation threshold, set the real-time defect recognition result to 1.

[0064] It should be noted that the above sequence of embodiments of the present application is only for description and does not represent the advantages or disadvantages of the embodiments. And the above describes specific embodiments of this specification. The processes depicted in the drawings do not necessarily require the specific order and continuous order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0065] The above are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the protection scope of the present application.

[0066] This specification and the drawings are only exemplary descriptions of the present application and are considered to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present application and its equivalent technologies, the present application is intended to include these changes and modifications.

Claims

1. A cup defect detection method based on machine vision, characterized in that, The method includes: After the cup to be detected enters the direction recognition area, trigger the first industrial camera to collect a top view of the cup to be detected, where the cup to be detected is in an upside-down state; Based on the top view, perform detection angle deviation analysis and output the real-time angle deviation; Match the PID gain parameters according to the real-time angle deviation; Use the PID gain parameters to control the rotation angle servo drive wheel to perform cup body angle correction until the cup to be detected leaves the direction control area; After the cup to be detected enters the defect detection area, activate the multi-view detection unit to collect images of the cup to be detected and output K detection surface images corresponding to K detection directions; Perform defect recognition on the K detection surface images to obtain the real-time defect recognition result; If the real-time defect recognition result is set to 1, trigger the pneumatic injection sorting device to remove the cup to be detected from the conveyor belt.

2. The method for detecting cup defects based on machine vision according to claim 1, wherein Match the PID gain parameters according to the real-time angle deviation, the method includes: Interactively obtain multiple sample PID gains for multiple sample angle deviation intervals; Use the real-time angle deviation to traverse the multiple sample angle deviation intervals to obtain M connected angle deviation intervals; Use the M connected angle deviation intervals to extract M connected PID gains from the multiple sample PID gains; Smooth the M connected PID gains and output the PID gain parameters.

3. The method for detecting cup defects based on machine vision according to claim 1, wherein, Perform defect recognition on the K detection surface images to obtain the real-time defect recognition result, the method includes: Interactively obtain K sample qualified image sets for the K detection directions; Perform histogram comparison on the K detection surface images and the K sample qualified image sets and output K first image similarity sets; Preset a defect similarity threshold. If all of the K first image similarity sets meet the defect similarity threshold, set the real-time defect recognition result to 0; Preset a defect similarity threshold. If any one of the image similarities in the K first image similarity sets does not meet the defect similarity threshold, set the real-time defect recognition result to 1.

4. The method for detecting cup defects based on machine vision according to claim 3, wherein The method further includes: When all of the K first image similarity sets meet the defect similarity threshold, perform geometric feature matching on the K detection surface images and the K sample qualified image sets and output K second image similarity sets; Preset a defect compensation threshold; If any one of the image similarities in the K second image similarity sets does not meet the defect compensation threshold, set the real-time defect recognition result to 1.

5. The method for detecting cup defects based on machine vision according to claim 1, characterized in that, Based on the top view, perform detection angle deviation analysis and output the real-time angle deviation, the method includes: Locate and identify the center coordinates of the cup bottom based on the top view to obtain an identified top view; Pre-construct a deviation angle recognition model; Input the identified top view into the deviation angle recognition model to perform reference angle deviation recognition and output the real-time angle deviation, where the real-time angle deviation has a deviation direction identifier.

6. The method for detecting cup defects based on machine vision according to claim 5, wherein Pre-construct a deviation angle recognition model, the method includes: Extract contour features and color features of the reference plastic seal mark as mark recognition features; Based on the marker recognition features, a marker positioning layer is constructed through the SIFT feature matching algorithm, where the marker positioning layer is used to locate the marker coordinates; The center connection lines of all reference marker points are fitted by the least squares method to generate a marker center connection line diagram; Based on the marker center connection line diagram and the marker connection line engine, a deviation angle recognition layer is constructed; The marker positioning layer and the deviation angle recognition layer are cascaded to complete the construction of the deviation angle recognition model.

7. The method for detecting cup defects based on machine vision according to claim 6, wherein Input the identification top view into the deviation angle recognition model to perform reference angle deviation recognition and output the real-time angle deviation. The method includes: Input the identification top view into the deviation angle recognition layer, and use the SIFT feature matching algorithm to compare the marker recognition features to locate the real-time marker coordinates; After inputting the identification top view into the deviation angle recognition layer, the marker connection line engine constructs a first deviation connection line in the identification top view according to the real-time marker coordinates and the cup bottom center coordinates; Project the first deviation connection line onto the marker center connection line diagram to collect the acute angle and output the real-time angle deviation.

8. A cup defect detection system based on machine vision, characterized in that, The system is used to execute the machine vision-based cup defect detection method according to any one of claims 1-7. The system includes: Top-down view module: After the cup to be detected enters the direction recognition area, trigger the first industrial camera to collect the top-down view of the cup to be detected, where the cup to be detected is in an upside-down state; Angle deviation analysis module: Perform detection angle deviation analysis based on the top-down view and output the real-time angle deviation; Gain parameter matching module: Match the PID gain parameters according to the real-time angle deviation; Cup body angle correction module: Use the PID gain parameters to control the rotation angle servo drive wheel to perform cup body angle correction until the cup to be detected leaves the direction control area; Image acquisition module: After the cup to be detected enters the defect detection area, activate the multi-view detection unit to perform image acquisition on the cup to be detected and output K detection surface images corresponding to K detection directions; Defect recognition module: Perform defect recognition on the K detection surface images to obtain the real-time defect recognition result; Defective cup rejection module: If the real-time defect recognition result is set to 1, trigger the pneumatic jet sorting device to remove the cup to be detected from the conveyor belt.

Citation Information

Cited By

  • Paper cup rim positioning method and system for paper cup stacking production line

    CN122134729A

  • Method and system for positioning the mouth of paper cups in a stacked paper cup production line

    CN122134729B