A machine vision-based method and system for detecting bottle cap seals

CN122573884APending Publication Date: 2026-08-14SHANDONG BAUSCH & LOMB FREDA PHARM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-26
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0009]本发明实施例提供了一种基于机器视觉的瓶盖密封检测方法及系统,以解决现有技术中的上述技术的问题

Benefits of technology

[0061]1、通过预设交叉双相机结合单应性变换模型实现了圆柱形瓶盖结构导致的部分区域无法覆盖的问题,避免漏检风险,确保对瓶盖整体状态的全面捕捉,并在前端引入自适应直方图均衡化与连通域面积滤波,强效清洗了水雾与反光伪影,为后续检测提供了坚固的特征基础。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122573884A_ABST
    Figure CN122573884A_ABST
Patent Text Reader

Abstract

This invention relates to the field of bottle cap sealing detection technology, and discloses a machine vision-based method and system for bottle cap sealing detection. The method includes: acquiring bottle cap images at the same time using cross-set cameras; sequentially preprocessing and binarizing the bottle cap images to obtain continuous and closed gap region images, and extracting observation data representing the bottle cap position; predicting the bottle cap's motion state based on a pre-constructed dynamic compensation model and historical parameters to obtain a state prediction result; the dynamic compensation model includes a state prediction equation and a state update equation; inputting the observation data into the state update equation to correct the state prediction result and eliminate vibration interference, obtaining target baseline data; and extracting multi-dimensional parameters of the bottle cap from the gap region images for sealing judgment to obtain the sealing result. This invention achieves comprehensive capture of the overall state of the bottle cap, replacing fuzzy qualitative judgments through multi-dimensional three-dimensional quantitative determination.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of bottle cap sealing performance testing technology, and in particular to a bottle cap sealing performance testing method and system based on machine vision. Background Technology

[0002] In the pharmaceutical filling and packaging industry, checking the tightness of bottle caps is a key step in controlling product quality. The quality of the seal directly determines whether the inside of the container will be subject to secondary contamination by microorganisms or impurities, and is a crucial physical barrier to ensure the safety and efficacy of drugs.

[0003] Currently, the mainstream technologies for detecting the tightness of bottle caps can be divided into the following three categories:

[0004] The first category is single-camera vision inspection technology, which uses a single industrial camera combined with backlighting or coaxial light sources. Edge detection algorithms are used to identify the width of the gap between the bottle cap and the bottle body to determine the tightness. Some existing solutions use a linear measuring device to calculate the distance difference between the top and bottom of the bottle cap to detect the seal. However, this technology has significant drawbacks: First, the curved surface of a round bottle cap means that a single camera cannot cover the entire circumference, resulting in blind spots and easy omissions in edge areas; second, during high-speed production line operations, vibrations can cause image blurring, leading to gap width calculation errors of ±0.2mm to ±0.3mm; finally, this solution lacks angle detection capability and cannot identify angular deviations in the bottle cap's rotation (i.e., it cannot detect misalignment).

[0005] The second type of multi-sensor fusion detection technology combines torque sensors, pressure sensors, and vision systems (such as multi-camera combined with laser scanning to achieve 3D modeling). It judges the sealing performance by measuring indicators such as tightening torque. Although this type of solution has high accuracy, it has obvious limitations: due to the multi-sensor configuration, the overall equipment cost is high; at the same time, the 3D modeling and multi-source data fusion process is time-consuming, and the detection speed is low, which cannot meet the real-time requirements of high-speed production lines; in addition, its anti-interference ability is weak, and laser scanning is easily affected by environmental factors such as water mist and oil stains, resulting in a high false detection rate in practical applications in the beverage industry.

[0006] The third type is mechanical contact detection technology, which uses mechanical probes or pressure rollers to physically squeeze the bottle cap and measure deformation or displacement, or uses a torque meter to detect the self-sealing of the bottle stopper. The contact probes of this type of solution are very easy to scratch the surface of the bottle cap, damaging the appearance of the product; it has poor adaptability and cannot be compatible with irregularly shaped bottle caps (such as plastic caps with anti-theft rings), and it is extremely sensitive to the height tolerance of the bottle body; because the mechanical parts are prone to wear during operation, the system maintenance cost is high and frequent shutdowns for calibration are required.

[0007] Therefore, existing technologies lack comprehensive multi-parameter detection capabilities. Current solutions often focus on single indicators (such as gap width or torque value), lacking comprehensive detection and quantification capabilities for gap area, angular deviation, and vibration interference. Companies often rely on empirical thresholds for judgment, resulting in extremely weak anti-interference capabilities in dynamic scenarios. On high-speed production lines, vibrations can cause relative displacement between the light source and camera, leading to a ghosting length of 3-7 pixels on the image sensor, making it difficult for traditional edge algorithms to eliminate interference in real time. Furthermore, the cylindrical curved surface of the bottle cap causes backlight scattering, and parallel backlighting still leaks light in the edge areas, reducing contrast in the gap area. Additionally, traditional light sources cannot reliably acquire clear gap images when facing the specular reflection of metal materials or the translucent nature of plastic materials.

[0008] Therefore, how to provide a method and system for detecting bottle cap seals using machine vision is an urgent problem to be solved. Summary of the Invention

[0009] This invention provides a machine vision-based method and system for detecting bottle cap seals, in order to solve the problems mentioned above in the prior art.

[0010] According to a first aspect of the present invention, a machine vision-based method for detecting bottle cap seals is provided.

[0011] In one embodiment, the machine vision-based bottle cap seal detection method includes:

[0012] Images of bottle caps at the same time are acquired using cameras set up at different times. The bottle cap images are preprocessed and binarized sequentially to obtain images of continuous and closed gap regions, and observation data representing the position of the bottle caps are extracted.

[0013] Based on a pre-built dynamic compensation model, the motion state of the bottle cap is predicted by combining historical parameters to obtain the state prediction result; wherein, the dynamic compensation model includes a state prediction equation and a state update equation.

[0014] The observed data is input into the state update equation, and the state prediction results are corrected to remove vibration interference, so as to obtain the target reference data.

[0015] Based on the target baseline data and combined with the image of the gap area, multi-dimensional parameters of the bottle cap are extracted to determine the sealing performance and obtain the sealing result.

[0016] In one embodiment, the steps of preprocessing and binarizing the bottle cap image sequentially to obtain a continuous and closed slit region image, and extracting observation data representing the position of the bottle cap, include the following steps:

[0017] Spatial domain filtering is applied to the bottle cap image for noise reduction, and an adaptive histogram equalization algorithm is used to enhance the denoised bottle cap image to obtain an enhanced image.

[0018] Based on the enhanced image, the region of interest (ROI) image representing the bottle cap is extracted, and the ROI image is segmented to obtain an initial binarized image. Then, morphological closing operation and connected component area filtering are used to filter the initial binarized image to obtain the target binarized image.

[0019] Contour search is performed on the binarized image of the target to identify the gap region image that represents the continuous and closed area of ​​the bottle cap, and the geometric center of the gap region image is calculated as the two-dimensional position coordinate point under the cross camera view.

[0020] By mapping and verifying the two-dimensional position coordinates, observation data representing the physical position of the bottle cap is obtained.

[0021] In one embodiment, the process of mapping and verifying the two-dimensional position coordinates to obtain observation data characterizing the physical position of the bottle cap includes the following steps:

[0022] Based on the pre-calibrated intrinsic and extrinsic parameter matrices of the cross camera, a homography transformation model is constructed. The two-dimensional position coordinates are input into the homography transformation model and mapped to a unified physical world coordinate system to obtain the first spatial coordinates and the second spatial coordinates.

[0023] Calculate the spatial deviation distance between the first spatial coordinate point and the second spatial coordinate point, and compare and verify the spatial deviation distance with the preset tolerance threshold.

[0024] When the spatial deviation distance is less than or equal to the tolerance threshold, the first spatial coordinate point and the second spatial coordinate point are fused to obtain the observation data.

[0025] When the spatial deviation distance is greater than the tolerance threshold, the first or second spatial coordinate point of the anomaly is removed, and the retained spatial coordinate point is selected as the observation data.

[0026] In one embodiment, predicting the motion state of the bottle cap by combining historical parameters to obtain the state prediction result includes the following steps:

[0027] Obtain the posterior state estimate from the previous time step and the historical error covariance matrix corresponding to the posterior state estimate;

[0028] Using the state transition matrix in the state prediction equation and combining it with the posterior state estimate, the prior prediction of the bottle cap's motion state at the current moment is calculated.

[0029] The historical error covariance matrix is ​​updated using the state transition matrix and the preset process noise covariance matrix to obtain the prior error covariance matrix at the current time. The state prediction result is then formed by combining the prior prediction value.

[0030] In one embodiment, the step of inputting the observation data into the state update equation, correcting the state prediction results to eliminate vibration interference, and obtaining the target reference data includes the following steps:

[0031] Based on the preset observation matrix and observation noise covariance matrix, and combined with the prior error covariance matrix in the state prediction results, the dynamic Kalman gain parameter at the current time is calculated.

[0032] The observation data is input into the state update equation, and the prior prediction values ​​in the state prediction results are mapped to the observation space using the observation matrix. The residual between the observation data and the mapped prior prediction values ​​is then calculated.

[0033] The residuals are weighted and corrected using the dynamic Kalman gain parameter to obtain the corrected prediction. The corrected prediction is then superimposed on the prior prediction to obtain the posterior state estimate at the current time.

[0034] Coordinate data representing the physical position of the bottle cap are extracted from the posterior state estimate and used as target baseline data;

[0035] Using the Kalman gain parameter and the observation matrix, the prior error covariance matrix is ​​calculated to obtain the posterior error covariance matrix at the current time, which is then used as the historical error covariance matrix for the next time step.

[0036] In one embodiment, the step of extracting multi-dimensional parameters of the bottle cap based on the target benchmark data and combining it with the gap area image to determine the sealing performance and obtain the sealing performance result includes:

[0037] Using the target reference data as spatial anchor points, the gap region image is spatially aligned, and the pixel ratio of the aligned gap region image is extracted. The gap area parameter is obtained by calculating the pixel ratio.

[0038] Extract the contour feature points of the bottle cap from the aligned gap region image, and calculate the angle deviation parameter from the contour feature points;

[0039] Spatial distribution discretization analysis of contour feature points is performed to obtain deformation parameters characterizing the flatness of the bottle cap edge;

[0040] The gap area parameter, angle deviation parameter, and deformation parameter are comprehensively compared and judged, and the judgment result is used as the sealing result.

[0041] In one embodiment, the step of extracting the contour feature points of the bottle cap in the aligned gap region image and calculating the angle deviation parameter from the contour feature points includes the following steps:

[0042] All contour feature points are aggregated to construct a discrete pixel set in a two-dimensional coordinate system;

[0043] The least squares method is used to perform linear fitting on the discrete pixel set to obtain the target slope parameter and construct the physical feature line;

[0044] Based on the target slope parameter, the angle parameter between the target slope parameter and the physical feature line is calculated using a preset horizontal baseline, and the angle parameter is used as the angle deviation parameter.

[0045] In one embodiment, the step of performing spatial distribution discretization analysis on the contour feature points to obtain the deformation parameter characterizing the smoothness of the bottle cap edge includes the following steps:

[0046] Based on the discrete pixel set, calculate the Euclidean distance from all contour feature points to the physical feature line, and construct a spatial distance residual sequence;

[0047] The expected value of all Euclidean distances in the spatial distance residual sequence is calculated, and the squared deviation between the Euclidean distance and the expected value is calculated. The average value of all squared deviations is then obtained to obtain the discrete mean square error, which is used as a parameter for quantifying the deformation degree of the bottle cap.

[0048] In one embodiment, the comprehensive comparison and judgment of the gap area parameter, angle deviation parameter, and deformation parameter includes the following steps:

[0049] When the gap area parameter is less than or equal to the preset area threshold, the angle deviation parameter is less than or equal to the preset angle threshold, and the deformation parameter is less than or equal to the preset deformation threshold, the current bottle cap is judged to be of qualified sealing performance.

[0050] If any one of the gap area parameter, angle deviation parameter, and deformation degree parameter is greater than the corresponding area threshold, angle threshold, and deformation threshold, the current bottle cap is determined to be unqualified in terms of sealing.

[0051] According to a second aspect of the present invention, a machine vision-based bottle cap seal detection system is provided, the system comprising:

[0052] The observation data extraction module is used to acquire bottle cap images at the same time using cross-set cameras, preprocess and binarize the bottle cap images sequentially to obtain continuous and closed gap region images, and extract observation data representing the position of the bottle cap.

[0053] The state prediction module is used to predict the motion state of the bottle cap based on a pre-built dynamic compensation model and combined with historical parameters, and obtain the state prediction result; wherein, the dynamic compensation model includes a state prediction equation and a state update equation.

[0054] The baseline data acquisition module is used to input observation data into the state update equation, correct the state prediction results to eliminate vibration interference, and obtain the target baseline data.

[0055] The sealing judgment module is used to extract multi-dimensional parameters of the bottle cap based on the target reference data and the gap area image to judge the sealing performance and obtain the sealing result.

[0056] According to a third aspect of the present invention, a computer device is provided.

[0057] In one embodiment, the computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described above.

[0058] According to a fourth aspect of the present invention, a computer-readable storage medium is provided.

[0059] In one embodiment, a computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the above method.

[0060] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:

[0061] 1. By using a pre-set cross dual camera combined with a homography transformation model, the problem of some areas not being covered due to the cylindrical bottle cap structure was solved, avoiding the risk of missed detection and ensuring comprehensive capture of the overall state of the bottle cap. Furthermore, adaptive histogram equalization and connected region area filtering were introduced at the front end to effectively remove water mist and reflection artifacts, providing a solid feature foundation for subsequent detection.

[0062] 2. By constructing a dynamic compensation model, high and low frequency mechanical vibration interference of the production line is smoothed out in real time and accurately to obtain stable target benchmark data. Finally, using this data as a spatial anchor point, the least squares method and spatial residual statistics are used to perform in-depth mathematical calculations, realizing multi-dimensional three-dimensional quantitative judgment of gap area, actual angle deviation and edge deformation degree, replacing fuzzy qualitative judgment.

[0063] 3. By optimizing the light source design, the risk of misjudgment caused by small gaps and production line vibration in the detection of cylindrical bottle caps is reduced, thereby improving the stability and reliability of the detection results.

[0064] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0065] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0066] Figure 1 This is a flowchart illustrating a machine vision-based bottle cap seal detection method according to an exemplary embodiment;

[0067] Figure 2 This is a schematic diagram illustrating a machine vision-based bottle cap seal detection system according to an exemplary embodiment.

[0068] Figure 3 This is a schematic diagram of the structure of a computer device according to an exemplary embodiment;

[0069] Figure 4 This is a schematic diagram of the arrangement of cross cameras in a machine vision-based bottle cap seal detection method according to an exemplary embodiment;

[0070] Figure 5 This is a schematic diagram illustrating an image extraction of a bottle cap based on a machine vision-based bottle cap seal detection method according to an exemplary embodiment.

[0071] Figure 6 This is a schematic diagram illustrating an exemplary embodiment of a machine vision-based bottle cap seal detection method for improving contrast in gap areas.

[0072] Figure 7 This is a schematic diagram of a light source structure for improving the contrast of a gap area in a machine vision-based bottle cap seal detection method, according to an exemplary embodiment. Detailed Implementation

[0073] The following description and accompanying drawings fully illustrate specific embodiments described herein to enable those skilled in the art to practice them. Some portions and features of certain embodiments may be included in or replace portions and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims and all available equivalents thereof. The various embodiments described herein are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments; similar or identical parts between embodiments can be referred to interchangeably.

[0074] The modules in the apparatus or system of this application can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0075] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0076] Figure 1 An embodiment of a machine vision-based bottle cap seal detection method of the present invention is shown.

[0077] In this optional embodiment, the machine vision-based bottle cap seal detection method includes:

[0078] S101. Use cameras with cross-set configurations to acquire bottle cap images at the same time. Perform preprocessing and binarization segmentation on the bottle cap images in sequence to obtain continuous and closed gap region images, and extract observation data representing the position of the bottle cap.

[0079] like Figure 4 As shown, in a specific implementation, the present invention uses a cross dual camera to photograph the bottle cap and the bottle body to obtain an image of the bottle cap. In addition, the dual cameras are synchronously photographed using a hardware triggering method to ensure that images are captured at the same time.

[0080] Furthermore, to enable adaptive recognition of bottle caps of different materials and colors, the lighting is enhanced so that the light source passes through the cylindrical surface to increase the contrast of the gap area, thus achieving adaptive recognition. This embodiment preferably employs the following method... Figure 6 The light source illumination structure shown is used for illumination, where 401 is a camera, 402 is the bottle cap and bottle body to be identified, and 403 is the light source device.

[0081] And the light source device can be such as Figure 7 The structure is achieved by consisting of a dustproof sheet 501, a parallel film 502, a diffuser plate 503, a surface-mount LED light 504, and an aluminum alloy shell 505, from top to bottom.

[0082] In this optional embodiment, the steps of preprocessing and binarizing the bottle cap image sequentially to obtain a continuous and closed slit region image, and extracting observation data representing the position of the bottle cap, include the following steps:

[0083] Spatial domain filtering is applied to the bottle cap image for noise reduction, and an adaptive histogram equalization algorithm is used to enhance the denoised bottle cap image to obtain an enhanced image.

[0084] Specifically, due to electromagnetic interference in industrial settings or thermal noise from camera sensors, the acquired bottle cap images often contain high-frequency discrete noise. Therefore, noise reduction processing is performed on the bottle cap images. The specific process is as follows:

[0085] A two-dimensional spatial sliding window of a preset size is constructed, and corresponding spatial weight coefficients are assigned to each position within the sliding window to form a spatial domain filtering template. The spatial domain filtering template is traversed pixel by pixel on the original bottle cap image matrix, so that the center of the sliding window is sequentially aligned with each target pixel in the image. After each sliding positioning, the initial gray values ​​of all pixels in the local neighborhood covered by the current sliding window are extracted, and these initial gray values ​​are weighted and summed with the corresponding spatial weight coefficients in the filtering template. The calculated weighted feature value is used as the new gray value of the current target pixel for updating the output.

[0086] It should be noted that due to the curved surface characteristics of the cylindrical bottle cap, when illuminated by a parallel light source, it is very easy to produce backlit dark areas or highlight scattering phenomena in the local area of ​​the image, resulting in a serious imbalance in the global contrast of the gap features. An adaptive histogram equalization algorithm is used for enhancement processing.

[0087] The denoised bottle cap image is spatially divided into multiple continuous and non-overlapping local image sub-blocks. The distribution frequency of each pixel gray level within each local image sub-block is statistically analyzed, and an independent local gray-level histogram is constructed for each local image sub-block. A preset contrast-limited cropping threshold is introduced to truncate each local gray-level histogram. When the distribution frequency of a certain gray level exceeds the cropping threshold, the excess pixel frequency is truncated, and the truncated excess pixel frequency is evenly distributed to all other gray levels within that local sub-block. This prevents excessive amplification of background noise in local dark areas during the averaging process. A bilinear interpolation algorithm is used to smoothly calculate the pixel gray values ​​at the edge junctions of adjacent sub-blocks, ultimately outputting an enhanced image with prominent seam features.

[0088] In addition, before performing adaptive histogram equalization, the denoised image is first subjected to illumination normalization: the global grayscale mean and standard deviation of the image are calculated, and the grayscale values ​​are linearly mapped to a unified illumination reference range to eliminate the influence of ambient light and light source attenuation.

[0089] Based on the enhanced image, the region of interest (ROI) image representing the bottle cap is extracted, and the ROI image is segmented to obtain an initial binarized image. Then, morphological closing operation and connected component area filtering are used to filter the initial binarized image to obtain the target binarized image.

[0090] Specifically, in actual industrial settings, due to the reflection of metal or plastic materials and the interference of environmental water droplets, the initial binarized image usually contains isolated highlight noise or exhibits the phenomenon of effective gaps being truncated by highlights.

[0091] A morphological closing operation is performed on the initial binarized image using structuring elements of a preset size. This involves sequentially performing dilation and erosion operations to bridge and repair minute gaps and fractures caused by reflections. All independent connected components in the image are traversed, and the total number of pixels within each component is counted to obtain the actual area parameter of that component. Based on the total actual area of ​​the current image's field of view, camera resolution, and the theoretical gap width range corresponding to a preset bottle cap specification database, the upper and lower limits of the effective gap area threshold are calculated in real time. When the actual area parameter is less than this threshold, the corresponding connected component is determined to be an artifact or noise point caused by water droplets or stray light, and the pixel grayscale value within that area is forcibly set to zero and removed. When the actual area parameter is greater than or equal to the area threshold, it is retained. After the above area screening process, the target binarized image is output.

[0092] Contour search is performed on the binarized image of the target to identify the gap region image that represents the continuous and closed area of ​​the bottle cap, and the geometric center of the gap region image is calculated as the two-dimensional position coordinate point under the cross camera view.

[0093] It should be noted that if no continuous and closed contour is found, the structuring element size of the morphological closing operation is increased sequentially, and the connected component filtering and contour search are repeated until the maximum number of iterations is reached; if it still cannot be closed, linear interpolation is performed on the two ends of the broken contour to generate a virtual closed region as the gap region image of the continuous and closed region.

[0094] like Figure 5 As shown, the purple box pointed to by 301 is the region of interest image, and the symmetrical green box pointed to by 302 is the gap region image.

[0095] By mapping and verifying the two-dimensional position coordinates, observation data representing the physical position of the bottle cap is obtained.

[0096] In this optional embodiment, the process of mapping and verifying the two-dimensional position coordinates to obtain observation data characterizing the physical position of the bottle cap includes the following steps:

[0097] Based on the pre-calibrated intrinsic and extrinsic parameter matrices of the cross camera, a homography transformation model is constructed. The two-dimensional position coordinates are input into the homography transformation model and mapped to a unified physical world coordinate system to obtain the first spatial coordinates and the second spatial coordinates.

[0098] Calculate the spatial deviation distance between the first spatial coordinate point and the second spatial coordinate point, and compare and verify the spatial deviation distance with the preset tolerance threshold.

[0099] When the spatial deviation distance is less than or equal to the tolerance threshold, the first spatial coordinate point and the second spatial coordinate point are fused to obtain the observation data.

[0100] When the spatial deviation distance is greater than the tolerance threshold, the first or second spatial coordinate point of the anomaly is removed, and the retained spatial coordinate point is selected as the observation data.

[0101] Specifically, the intrinsic and extrinsic parameter matrices of the cross-cameras are retrieved. The intrinsic parameter matrix contains internal optical parameters such as focal length and optical center coordinates of each camera, while the extrinsic parameter matrix contains rotation matrix and translation vector reflecting the spatial pose of the camera relative to a unified physical world coordinate system. The intrinsic and extrinsic parameter matrices are fused by matrix multiplication to calculate the homography transformation matrix (i.e., homography transformation model) used to describe the perspective mapping relationship between the camera pixel plane and the actual physical detection plane.

[0102] The two-dimensional position coordinates are converted into homogeneous coordinates and solved with the corresponding homography transformation matrix to eliminate spatial perspective distortion caused by the tilted installation of the cross camera. The image pixel coordinates are accurately projected onto the unified physical world coordinate system to obtain the first and second spatial coordinates with actual physical scale.

[0103] Calculate the absolute Euclidean distance between the first spatial coordinate point and the second spatial coordinate point in the physical world coordinate system, use it as the spatial deviation distance, and compare the spatial deviation distance with the preset system tolerance threshold for verification to obtain the observation data.

[0104] It should be noted that the homography transformation model is essentially a mathematical matrix model that characterizes the projective geometric relationship between two three-dimensional spatial planes. In this embodiment, it constructs a coordinate mapping bridge between the two-dimensional pixel plane of the camera and the actual detection physical plane, thereby eliminating spatial perspective distortion caused by the tilted shooting of the cross camera.

[0105] S102. Based on the pre-built dynamic compensation model, the motion state of the bottle cap is predicted by combining historical parameters to obtain the state prediction result; wherein, the dynamic compensation model includes a state prediction equation and a state update equation.

[0106] In this optional embodiment, the prediction of the bottle cap's motion state by combining historical parameters to obtain the state prediction result includes the following steps:

[0107] Obtain the posterior state estimate from the previous time step and the historical error covariance matrix corresponding to the posterior state estimate;

[0108] Using the state transition matrix in the state prediction equation and combining it with the posterior state estimate, the prior prediction of the bottle cap's motion state at the current moment is calculated.

[0109] The historical error covariance matrix is ​​updated using the state transition matrix and the preset process noise covariance matrix to obtain the prior error covariance matrix at the current time. The state prediction result is then formed by combining the prior prediction value.

[0110] Specifically, when bottle caps and bottles are transported on a conveyor belt, vibration is inevitable. The error caused by vibration is positively correlated with the false detection rate of seal integrity. Therefore, it is necessary to predict the vibration resistance of the bottle caps and bottles. Vibration is the rapid change of the bottle cap's position and velocity in a two-dimensional plane. Therefore, a state vector is defined based on position and velocity, and its mathematical expression is:

[0111] ;

[0112] In the formula, and The coordinates of the bottle cap's position in the two-dimensional plane (x, y) are in mm. and The velocity of the bottle cap in the two-dimensional plane (x, y) is expressed in mm / s. Let k be the state vector, and k be the current sampling time step.

[0113] Obtain the posterior state estimate of the previous time step from the historical parameters, and combine it with the state transition matrix to calculate the prior prediction of the bottle cap's current motion state. The mathematical expression for this is:

[0114] ;

[0115] In the formula, for The optimal posterior state estimate at time t. Here is the state transition matrix. For based on Predict the prior value of the motion state at time k.

[0116] The state transition matrix A describes how the state evolves from the previous time step to the current time step, and its expression is:

[0117] ;

[0118] The matrix means: new position = old position + velocity × time interval, where the time interval is Δt; new velocity = 0 × old position + 1 × old velocity.

[0119] Simultaneously, the historical error covariance matrix is ​​calculated using the state transition matrix and the preset process noise covariance matrix to obtain the prior error covariance matrix at the current moment (i.e., the uncertainty prediction equation), whose expression is:

[0120] ;

[0121] In the formula, The process noise covariance matrix is... for The error covariance matrix P at time point (i.e., the historical error covariance matrix). This is the transpose of the state transition matrix A. Let be the prior error covariance matrix.

[0122] The expression for the process noise covariance matrix is ​​as follows:

[0123] ;

[0124] In the formula, Δt is the time interval. The acceleration variance coefficient of the bottle cap.

[0125] It should be noted that, The key parameter of the dynamic compensation model represents the degree of inaccuracy of the model (e.g., sudden oscillations can be considered strong process noise), determining whether the filter trusts predictions or observations more. The larger it is set (i.e.) If the dynamic compensation model prediction is unreliable, the Kalman gain will increase, making the filter more confident in the observed data; when The smaller the value, the more the filter trusts the predicted data.

[0126] In practical applications, the time interval is preferably set to 0.01s (i.e., 100fps). The preferred setting is 0.1 (unit: mm² / s). 4 ).

[0127] The state prediction result is composed of the prior error covariance matrix and the prior predicted value.

[0128] S103. Input the observation data into the state update equation, correct the state prediction results to eliminate vibration interference, and obtain the target reference data.

[0129] In this optional embodiment, the process of inputting observation data into the state update equation and correcting the state prediction results to eliminate vibration interference, thereby obtaining the target reference data, includes the following steps:

[0130] Based on the preset observation matrix and observation noise covariance matrix, and combined with the prior error covariance matrix in the state prediction results, the dynamic Kalman gain parameter at the current time is calculated.

[0131] The observation data is input into the state update equation, and the prior prediction values ​​in the state prediction results are mapped to the observation space using the observation matrix. The residual between the observation data and the mapped prior prediction values ​​is then calculated.

[0132] The residuals are weighted and corrected using the dynamic Kalman gain parameter to obtain the corrected prediction. The corrected prediction is then superimposed on the prior prediction to obtain the posterior state estimate at the current time.

[0133] Coordinate data representing the physical position of the bottle cap are extracted from the posterior state estimate and used as target baseline data;

[0134] Using the Kalman gain parameter and the observation matrix, the prior error covariance matrix is ​​calculated to obtain the posterior error covariance matrix at the current time, which is then used as the historical error covariance matrix for the next time step.

[0135] Specifically, the expression for calculating the dynamic Kalman gain parameter at the current moment is:

[0136] ;

[0137] In the formula, For dynamic Kalman gain parameters, Let be the prior error covariance matrix. The transpose of the observation matrix H, To observe the noise covariance matrix.

[0138] The expression for the observation matrix H is:

[0139] ;

[0140] The meaning of the observation matrix H is: only the observed position and without observing speed and .

[0141] The expression for the observation noise covariance matrix is ​​as follows:

[0142] ;

[0143] In the formula, The variance of observation noise when the cross camera measures the position coordinates along the x-axis. This represents the observation noise variance when the cross camera measures the position coordinates along the y-axis.

[0144] It should be noted that the observation noise covariance matrix represents the noise level of the observed data. When R (i.e., or The larger R is set, the less reliable the observation data is, the smaller the dynamic Kalman gain parameter will be, and the filter will trust the prediction more. When R is set smaller, the more accurate the observation data is, the larger the dynamic Kalman gain parameter will be, and the filter will trust the observation data more.

[0145] In practical applications, and The preferred setting is 0.05 mm².

[0146] Using the observed data as input, and combining the observation matrix and dynamic Kalman gain parameters, the expression for the posterior state estimate at the current time step is:

[0147] ;

[0148] In the formula, This is the posterior state estimate. For the observation data at the current moment, For dynamic Kalman gain parameters, These are the prior predicted values. For the observation matrix, The new information refers to the difference between the prior prediction and the observed data.

[0149] The prior error covariance matrix is ​​updated using the dynamic Kalman gain parameter and the observation matrix to obtain the historical error covariance matrix for the next time step, which is expressed as follows:

[0150]

[0151] In the formula, The historical error covariance matrix for the next time step. Let be the prior error covariance matrix. For dynamic Kalman gain parameters, For the observation matrix, It is an identity matrix.

[0152] It should be noted that, based on the difference between the prior predicted value and the observed data (i.e., the innovation), a time sliding window of a preset length is constructed. By continuously taking historical innovations at multiple sampling time steps, a innovation sequence is formed. The positive and negative zero-crossing rates and the innovation variance of the innovation sequence within the sliding window are calculated respectively.

[0153] When the zero-crossing rate of the innovation sequence is greater than a preset frequency threshold and the innovation variance is less than a preset amplitude threshold, the current vibration type is determined to be high-frequency small-amplitude jitter. At this time, the value of the observation noise covariance matrix R is adaptively increased, forcing the filter to reduce the dynamic Kalman gain parameter, reducing the confidence in transient observation data, and maintaining the smoothness of bottle cap position tracking.

[0154] When the zero-crossing rate of the innovation sequence is less than or equal to a preset frequency threshold, and the innovation variance is greater than or equal to a preset amplitude threshold, the system determines the current vibration type as low-frequency large-amplitude shaking. At this time, the process noise covariance matrix is ​​adaptively increased. The value of forces the filter to significantly increase the dynamic Kalman gain parameter, greatly trusting the real-time observation data from the cross camera and correcting prediction bias.

[0155] In practical applications, the frequency threshold can be preferably set to 15Hz, and the amplitude threshold can be preferably set to 0.05mm. When high-frequency small-amplitude jitter occurs:

[0156] ;

[0157] In the formula, To obtain the initial calibration values ​​for the observed noise covariance matrix, Let f be the maximum value of the main frequency f of the innovation, and =15Hz.

[0158] When low-frequency, large-amplitude shaking occurs:

[0159] ;

[0160] In the formula, The initial calibration values ​​for the process noise covariance matrix are given. Average amplitude of new information The maximum value, and =0.05mm.

[0161] In addition, the hardware trigger timestamp of each frame of image is recorded, and the timestamp is used to perform linear interpolation to align the observed data with the state prediction values ​​in order to eliminate the time deviation caused by the delay in image acquisition and processing.

[0162] S104. Based on the target baseline data and combined with the gap area image, extract the multi-dimensional parameters of the bottle cap to judge the sealing performance and obtain the sealing performance result.

[0163] In this optional embodiment, the step of extracting multi-dimensional parameters of the bottle cap based on the target reference data and combining the gap area image to determine the sealing performance and obtain the sealing performance result includes:

[0164] Using the target reference data as spatial anchor points, the gap region image is spatially aligned, and the pixel ratio of the aligned gap region image is extracted. The gap area parameter is obtained by calculating the pixel ratio.

[0165] Extract the contour feature points of the bottle cap from the aligned gap region image, and calculate the angle deviation parameter from the contour feature points;

[0166] It should be noted that the calculation method for the gap area parameter is as follows:

[0167] Slit area parameter = (total number of slit pixels / total number of pixels in the slit area image) × total actual area of ​​the field of view.

[0168] The unit for the slit area parameter is mm², and the unit for the total actual area of ​​the field of view is mm².

[0169] In this optional embodiment, the step of extracting the contour feature points of the bottle cap in the aligned gap region image and calculating the angle deviation parameter from the contour feature points includes the following steps:

[0170] All contour feature points are aggregated to construct a discrete pixel set in a two-dimensional coordinate system;

[0171] The least squares method is used to perform linear fitting on the discrete pixel set to obtain the target slope parameter and construct the physical feature line;

[0172] Based on the target slope parameter, the angle parameter between the target slope parameter and the physical feature line is calculated using a preset horizontal baseline, and the angle parameter is used as the angle deviation parameter.

[0173] Specifically, for the discrete pixel set in the aggregated two-dimensional coordinate system, a univariate linear regression equation is constructed, and the objective function of the residual sum of squares from the physical coordinates of each contour feature point to the regression equation is established. To obtain the best-fitting straight line, the partial derivatives of the slope and intercept parameters of the objective function are calculated and set to zero to solve for the minimum error state, thereby calculating the optimal slope and intercept parameters of the straight line and constructing the physical feature line. The calculated optimal slope parameter is extracted and transformed into a tilt angle in physical space based on the inverse trigonometric function mapping rule, and the actual angle parameter between the physical feature line and the preset horizontal baseline is calculated. The absolute value of the calculated angle parameter is extracted as the angle deviation parameter to accurately quantify and characterize the degree of angle rotation and twisting defects that occur during the assembly process of the bottle cap.

[0174] In practical applications, the random sampling consensus algorithm can be used first to perform linear fitting on the discrete pixel set, remove outliers, and then apply the least squares method to calculate the final slope parameter. When computational resources are limited, high-confidence contour points can be selected first by using local gray-level gradients.

[0175] Spatial distribution discretization analysis of contour feature points is performed to obtain deformation parameters characterizing the flatness of the bottle cap edge;

[0176] In this optional embodiment, the step of performing spatial distribution discrete analysis on the contour feature points to obtain the deformation degree parameter characterizing the smoothness of the bottle cap edge includes the following steps:

[0177] Based on the discrete pixel set, calculate the Euclidean distance from all contour feature points to the physical feature line, and construct a spatial distance residual sequence;

[0178] The expected value of all Euclidean distances in the spatial distance residual sequence is calculated, and the squared deviation between the Euclidean distance and the expected value is calculated. The average value of all squared deviations is then obtained to obtain the discrete mean square error, which is used as a parameter for quantifying the deformation degree of the bottle cap.

[0179] Specifically, the normal vector parameters of the physical feature line are obtained, and all contour feature points in the discrete pixel set are traversed. The absolute Euclidean distance from each feature point along the normal vector direction to the physical feature line is calculated to construct a spatial distance residual sequence. The expected value of all Euclidean distances in this spatial distance residual sequence is calculated. This expected value is used to characterize the average reference position of the bottom edge contour of the bottle cap in a macroscopic statistical sense. The squared deviation between each absolute Euclidean distance and the expected value in this spatial distance residual sequence is calculated. The sum of all squared deviations is calculated, and the average value is obtained to obtain the discrete mean square error. The calculated discrete mean square error is used as the deformation degree parameter to quantify the smoothness of the bottle cap edge. At the same time, the mean square error of the standard contour distance residual sequence of qualified bottle caps of the same specification is pre-collected. The deformation degree parameter of the current bottle cap is calculated with the pre-collected variance to eliminate the interference of fitting error and sampling noise. The larger the value of this parameter, the more severe the physical undulation and burr distribution of the bottle cap edge, and the higher the probability of edge damage or stripping.

[0180] The gap area parameter, angle deviation parameter, and deformation parameter are comprehensively compared and judged, and the judgment result is used as the sealing result.

[0181] In this optional embodiment, the comprehensive comparison and judgment of the gap area parameter, angle deviation parameter, and deformation parameter includes the following steps:

[0182] When the gap area parameter is less than or equal to the preset area threshold, the angle deviation parameter is less than or equal to the preset angle threshold, and the deformation parameter is less than or equal to the preset deformation threshold, the current bottle cap is judged to be of qualified sealing performance.

[0183] If any one of the gap area parameter, angle deviation parameter, and deformation degree parameter is greater than the corresponding area threshold, angle threshold, and deformation threshold, the current bottle cap is determined to be unqualified in terms of sealing.

[0184] When a bottle cap with a poor seal is detected, an alarm is triggered and the bottle is rejected. Simultaneously, every preset time interval (e.g., 30 minutes) or after a cumulative inspection of N products, an image of the standard calibration block (i.e., the preset circular device) located on the conveyor belt is automatically acquired, and the deviation between the current homography transformation matrix and the initial calibration value is recalculated. If the deviation exceeds the preset tolerance, automatic recalibration is triggered, or an alarm is issued prompting manual correction.

[0185] Furthermore, in specific applications, the area threshold range is preferably set to 0.5 mm² to 5.0 mm², the angle threshold range is preferably within 0.5° to 3.0°, and the deformation threshold range is preferably within 0.02 mm to 0.10 mm.

[0186] It should be noted that, in order to be compatible with the detection of bottle caps of different sizes and heights, a multi-specification threshold database corresponding to the bottle cap specifications is pre-built in this embodiment. When the bottle cap to be detected is changed, the corresponding threshold is also adaptively changed based on the multi-specification threshold database. At the same time, the multi-dimensional parameter distribution of continuously qualified products is statistically analyzed in real time. When the long-term mean of a certain parameter drifts beyond the preset limit, the threshold is automatically updated and a prompt confirmation signal is sent.

[0187] Figure 2 An embodiment of a machine vision-based bottle cap seal detection system of the present invention is shown.

[0188] In this optional embodiment, the machine vision-based bottle cap seal detection system includes:

[0189] The observation data extraction module 201 is used to acquire bottle cap images at the same time using cross-set cameras, preprocess and binarize the bottle cap images sequentially to obtain continuous and closed gap region images, and extract observation data representing the position of the bottle cap.

[0190] The state prediction module 202 is used to predict the motion state of the bottle cap based on a pre-built dynamic compensation model and combined with historical parameters to obtain the state prediction result; wherein, the dynamic compensation model includes a state prediction equation and a state update equation.

[0191] The reference data acquisition module 203 is used to input the observation data into the state update equation, correct the state prediction results to remove vibration interference, and obtain the target reference data.

[0192] The sealing judgment module 204 is used to extract multi-dimensional parameters of the bottle cap based on the target reference data and the gap area image to judge the sealing performance and obtain the sealing result.

[0193] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores static and dynamic information data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the above method embodiments.

[0194] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0195] In addition, the present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0196] In addition, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0197] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0198] This invention is not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this invention is limited only by the appended claims.

Claims

1. A machine vision-based method for detecting bottle cap seals, characterized in that, include: Images of bottle caps at the same time are acquired using cameras set up at different times. The bottle cap images are preprocessed and binarized sequentially to obtain images of continuous and closed gap regions, and observation data representing the position of the bottle caps are extracted. Based on a pre-built dynamic compensation model, the motion state of the bottle cap is predicted by combining historical parameters to obtain the state prediction result; wherein, the dynamic compensation model includes a state prediction equation and a state update equation. The observed data is input into the state update equation, and the state prediction results are corrected to remove vibration interference, so as to obtain the target reference data. Based on the target baseline data and combined with the image of the gap area, multi-dimensional parameters of the bottle cap are extracted to determine the sealing performance and obtain the sealing result.

2. The bottle cap seal detection method based on machine vision according to claim 1, characterized in that, The steps of preprocessing and binarizing the bottle cap image sequentially to obtain a continuous and closed slit region image, and extracting observation data representing the position of the bottle cap, include the following: Spatial domain filtering is applied to the bottle cap image for noise reduction, and an adaptive histogram equalization algorithm is used to enhance the denoised bottle cap image to obtain an enhanced image. Based on the enhanced image, the region of interest (ROI) image representing the bottle cap is extracted, the ROI image is segmented to obtain an initial binarized image, and the initial binarized image is filtered using morphological closing operation and connected component area filtering to obtain the target binarized image. Contour search is performed on the binarized image of the target to identify the gap region image that represents the continuous and closed area of ​​the bottle cap, and the geometric center of the gap region image is calculated as the two-dimensional position coordinate point under the cross camera view. By mapping and verifying the two-dimensional position coordinates, observation data representing the physical position of the bottle cap is obtained.

3. The bottle cap seal detection method based on machine vision according to claim 2, characterized in that, The process of mapping and verifying the two-dimensional position coordinates to obtain observation data representing the physical position of the bottle cap includes the following steps: Based on the pre-calibrated intrinsic and extrinsic parameter matrices of the cross camera, a homography transformation model is constructed. The two-dimensional position coordinates are input into the homography transformation model and mapped to a unified physical world coordinate system to obtain the first spatial coordinates and the second spatial coordinates. Calculate the spatial deviation distance between the first spatial coordinate point and the second spatial coordinate point, and compare and verify the spatial deviation distance with the preset tolerance threshold. When the spatial deviation distance is less than or equal to the tolerance threshold, the first spatial coordinate point and the second spatial coordinate point are fused to obtain the observation data. When the spatial deviation distance is greater than the tolerance threshold, the first or second spatial coordinate point of the anomaly is removed, and the retained spatial coordinate point is selected as the observation data.

4. The method for detecting bottle cap seals based on machine vision according to claim 1, characterized in that, The process of predicting the motion state of the bottle cap by combining historical parameters to obtain the state prediction result includes the following steps: Obtain the posterior state estimate from the previous time step and the historical error covariance matrix corresponding to the posterior state estimate; Using the state transition matrix in the state prediction equation and combining it with the posterior state estimate, the prior prediction of the bottle cap's motion state at the current moment is calculated. The historical error covariance matrix is ​​updated using the state transition matrix and the preset process noise covariance matrix to obtain the prior error covariance matrix at the current time. The state prediction result is then formed by combining the prior prediction value.

5. The method for detecting bottle cap seals based on machine vision according to claim 1, characterized in that, The process of inputting observation data into the state update equation, correcting the state prediction results to eliminate vibration interference, and obtaining target reference data includes the following steps: Based on the preset observation matrix and observation noise covariance matrix, and combined with the prior error covariance matrix in the state prediction results, the dynamic Kalman gain parameter at the current time is calculated. The observation data is input into the state update equation, and the prior prediction values ​​in the state prediction results are mapped to the observation space using the observation matrix. The residual between the observation data and the mapped prior prediction values ​​is then calculated. The residuals are weighted and corrected using the dynamic Kalman gain parameter to obtain the corrected prediction. The corrected prediction is then superimposed on the prior prediction to obtain the posterior state estimate at the current time. Coordinate data representing the physical position of the bottle cap are extracted from the posterior state estimate and used as target baseline data; Using the Kalman gain parameter and the observation matrix, the prior error covariance matrix is ​​calculated to obtain the posterior error covariance matrix at the current time, which is then used as the historical error covariance matrix for the next time step.

6. The bottle cap seal detection method based on machine vision according to claim 5, characterized in that, The process of extracting multi-dimensional parameters of the bottle cap based on the target baseline data and combining the gap area image to determine the sealing performance, and obtaining the sealing performance result includes: Using the target reference data as spatial anchor points, the gap region image is spatially aligned, and the pixel ratio of the aligned gap region image is extracted. The gap area parameter is obtained by calculating the pixel ratio. Extract the contour feature points of the bottle cap from the aligned gap region image, and calculate the angle deviation parameter from the contour feature points; Spatial distribution discretization analysis of contour feature points is performed to obtain deformation parameters characterizing the flatness of the bottle cap edge; The gap area parameter, angle deviation parameter, and deformation parameter are comprehensively compared and judged, and the judgment result is used as the sealing result.

7. The bottle cap seal detection method based on machine vision according to claim 6, characterized in that, The steps for extracting the contour feature points of the bottle cap in the aligned gap region image and calculating the angle deviation parameter from these contour feature points include: All contour feature points are aggregated to construct a discrete pixel set in a two-dimensional coordinate system; The least squares method is used to perform linear fitting on the discrete pixel set to obtain the target slope parameter and construct the physical feature line; Based on the target slope parameter, the angle parameter between the target slope parameter and the physical feature line is calculated using a preset horizontal baseline, and the angle parameter is used as the angle deviation parameter.

8. The bottle cap seal detection method based on machine vision according to claim 7, characterized in that, The step of performing spatial distribution discretization analysis on the contour feature points to obtain the deformation parameter characterizing the smoothness of the bottle cap edge includes the following steps: Based on the discrete pixel set, calculate the Euclidean distance from all contour feature points to the physical feature line, and construct a spatial distance residual sequence; The expected value of all Euclidean distances in the spatial distance residual sequence is calculated, and the squared deviation between the Euclidean distance and the expected value is calculated. The average value of all squared deviations is then obtained to obtain the discrete mean square error, which is used as a parameter for quantifying the deformation degree of the bottle cap.

9. The bottle cap seal detection method based on machine vision according to claim 6, characterized in that, The comprehensive comparison and judgment of gap area parameters, angle deviation parameters, and deformation parameters includes the following steps: When the gap area parameter is less than or equal to the preset area threshold, the angle deviation parameter is less than or equal to the preset angle threshold, and the deformation parameter is less than or equal to the preset deformation threshold, the current bottle cap is judged to be of qualified sealing performance. If any one of the gap area parameter, angle deviation parameter, and deformation degree parameter is greater than the corresponding area threshold, angle threshold, and deformation threshold, the current bottle cap is determined to be unqualified in terms of sealing.

10. A bottle cap seal detection system based on machine vision, characterized in that, The system includes: The observation data extraction module is used to acquire bottle cap images at the same time using cross-set cameras, preprocess and binarize the bottle cap images sequentially to obtain continuous and closed gap region images, and extract observation data representing the position of the bottle cap. The state prediction module is used to predict the motion state of the bottle cap based on a pre-built dynamic compensation model and combined with historical parameters, and obtain the state prediction result; wherein, the dynamic compensation model includes a state prediction equation and a state update equation. The baseline data acquisition module is used to input observation data into the state update equation, correct the state prediction results to eliminate vibration interference, and obtain the target baseline data. The sealing judgment module is used to extract multi-dimensional parameters of the bottle cap based on the target reference data and the gap area image to judge the sealing performance and obtain the sealing result.