A bottle cap and liquid level detection method and system

By using a detection system with a color camera and vibration sensor in a high-speed filling production line, combined with deformation compensation and multi-view calibration technology, the problem of inaccurate cap tightening and liquid level detection caused by conveyor line vibration has been solved, achieving high-precision and stable detection results.

CN123175397APending Publication Date: 2026-11-27SUZHOU HAWKY SYST INSPECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611473852.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-21
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In high-speed filling production lines, vibration of the conveyor line causes deformation of the bottle image, affecting the tightness of the cap and the accuracy of liquid level detection. Existing technologies are insufficient to meet the requirements for detection accuracy.

Method used

The detection system employs at least four color cameras, a light source array, and vibration sensors. It controls the timing of image acquisition through vibration signals, performs deformation compensation parameter correction, assigns confidence weights to reference points, verifies multi-view coplanarity, and reconstructs the local coordinate system of the bottle cap to achieve accurate positioning of liquid level and detection of bottle cap defects.

Benefits of technology

The method improves the accuracy and stability of cap tightening and liquid level detection under high-speed vibration conditions, reduces the impact of vibration interference and artifacts on the misjudgment of detection results, and enhances the adaptability of the detection method under different vibration conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123175397A_ABST
    Figure CN123175397A_ABST
Patent Text Reader

Abstract

The application discloses a bottle cap and liquid level detection method and system, which is applied to a detection system comprising at least four color cameras. The method comprises: acquiring multi-view bottle body images and synchronous vibration signals; determining deformation compensation parameters according to the vibration signals; for each view, extracting horizontal reference points from the center points of the upper edges of the bottle cap, correcting and matching the left and right area templates of the support ring according to the deformation compensation parameters, and obtaining vertical reference points through reverse correction; according to the spatial projection relationship between the image positions of the reference points and the vibration velocity vectors, assigning confidence weights, solving the global center coordinates and the rotation angle of the bottle body, and reconstructing the local coordinate system of the bottle cap; projecting the liquid surface candidate line to the three-dimensional space to perform coplanarity verification, eliminating artifacts, and determining the liquid level height; and performing bottle cap defect detection in the local coordinate system of the bottle cap, and outputting the comprehensive detection result. The application helps to improve the precision and stability of bottle cap and liquid level detection under high-speed vibration conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine vision inspection, and in particular to a method and system for detecting bottle caps and liquid levels. Background Technology

[0002] In bottling lines for carbonated beverages and aseptic pharmaceuticals, cap tightness and liquid level are core indicators for product quality control. Related technologies typically employ industrial cameras to photograph bottles on the conveyor line, using image processing algorithms to determine if the cap is properly screwed on, if the liquid level is adequate, and if defects such as missing caps exist. For example, one related technology uses multiple monochrome industrial cameras arranged in a circular pattern to capture bottle outline images through backlighting, and then uses edge detection and threshold segmentation algorithms to determine whether the cap is missing and whether the liquid level is visible.

[0003] However, in high-speed filling lines, the conveyor speed can reach 300 bottles per minute, and the bottles will experience axial vibration as they move along the conveyor. When the aforementioned technologies are implemented, the vibration of the conveyor will cause deformation of the acquired bottle images, especially in the support ring area, where the vibration causes periodic stretching or compression. This reduces the positioning accuracy of the support ring reference point in the image, consequently decreasing the accuracy of the cap tightness judgment and easily leading to the mistaken rejection of qualified products or the release of unqualified products.

[0004] The aforementioned technologies have the following drawbacks: image distortion caused by conveyor line vibration leads to inaccurate positioning of reference points, making it difficult to meet the requirements of high-speed production lines in terms of cap tightness and liquid level detection. Summary of the Invention

[0005] To overcome the above problems, this application provides a bottle cap and liquid level detection method and system, which adopts the following technical means.

[0006] A method for detecting bottle caps and liquid levels, applied to a detection system comprising at least four color cameras, a light source array, and a vibration sensor, wherein the at least four color cameras cover the entire circumference of the bottle, the method comprising the following steps: Multiple bottle images and synchronous vibration signals are acquired from different perspectives by the color camera, and each bottle image is acquired within a phase window where the vibration velocity of the vibration signal is in a preset low-speed range. Deformation compensation parameters are determined based on the vibration signal; For the bottle image from each viewpoint, the center points of the left and right edges of the bottle cap are extracted to obtain the lateral reference points; the matching templates of the left and right regions of the bottle cap support ring are corrected and matched and reversed according to the deformation compensation parameters to obtain the longitudinal reference points. Based on the spatial projection relationship between the image position of each reference point and the vibration velocity vector, the confidence weight of the reference points for each viewpoint is assigned, and the global center coordinates and rotation angle of the bottle are calculated based on the confidence weights, and the local coordinate system of the bottle cap is reconstructed. Based on the global center coordinates and the rotation angle, the candidate lines of the liquid surface from each viewpoint are back-projected into the three-dimensional space to perform coplanarity verification. Based on the verification results, artifacts are removed and the liquid level height is determined. Based on the liquid level height, it is determined whether the liquid level of the bottle is qualified. Perform bottle cap defect detection in the local coordinate system of the bottle cap, and output a comprehensive detection result that includes the liquid level height and the bottle cap defect detection result.

[0007] By adopting the above technical solution, through the coordinated steps of acquiring images via vibration phase window, matching templates for deformation compensation parameter correction, allocating confidence weights based on spatial projection relationships, and verifying coplanarity from multiple perspectives, vibration signals are simultaneously used to control the timing of image acquisition, correct image deformation, and allocate reference point weights. This allows for accurate calculation of the global center coordinates and rotation angle of the bottle body even under high-speed vibration conditions, and reliable determination of liquid level height and detection of bottle cap defects, thus improving detection accuracy and stability.

[0008] Preferably, determining the deformation compensation parameters based on the vibration signal specifically includes the following steps: The vibration sensor collects vibration acceleration signals along the height direction of the bottle body, and the vibration sensor is installed on the base of the bottle body conveyor line; Frequency domain analysis was performed on the vibration acceleration signal to extract the dominant vibration frequency and its amplitude. The main frequency amplitude is mapped to a scaling factor to obtain the deformation compensation parameter containing the scaling factor.

[0009] By adopting the above technical solution, the vibration acceleration signal in the height direction of the bottle is collected and the vibration main frequency and main frequency amplitude are extracted. The main frequency amplitude is mapped to a scaling factor so that the deformation compensation parameter can accurately reflect the actual impact of vibration on the image, providing a reliable parameter basis for subsequent template correction.

[0010] Preferably, the step of correcting and re-correcting the matching templates of the left and right regions of the bottle cap support ring according to the deformation compensation parameters to obtain the longitudinal reference point specifically includes the following steps: The matching template is scaled according to the scaling factor, and normalized cross-correlation template matching is performed on the left and right regions of the bottle cap support ring to obtain the matching center coordinates of the left region and the matching center coordinates of the right region. The coordinates of the matching center of the left region and the coordinates of the matching center of the right region are scaled by the reciprocal of the scaling factor to restore them to the original image coordinate system, thus obtaining the vertical reference point.

[0011] By adopting the above technical solution, after scaling the matching template according to the scaling factor, normalized cross-correlation template matching is performed, and then the matching center coordinates are scaled inversely according to the reciprocal of the scaling factor, so that the longitudinal reference points of the left and right regions of the support ring can be accurately restored in the original image coordinate system, which helps to improve the positioning accuracy of the longitudinal reference points.

[0012] Preferably, mapping the main frequency amplitude to a scaling factor specifically includes the following steps: Determine the base deformation coefficient corresponding to the frequency band to which the vibration dominant frequency belongs, and obtain the initial scaling factor based on the product of the base deformation coefficient and the amplitude of the dominant frequency; Calculate a sharpness evaluation value based on gradient information for the support ring region image obtained after deformation correction; When the sharpness evaluation value does not meet the preset convergence condition, the initial scaling factor is iteratively corrected according to the preset step size and template matching is re-executed until the sharpness evaluation value meets the preset convergence condition or reaches the preset number of times limit; If the preset convergence condition is not met even after reaching the preset maximum number of attempts, the initial scaling factor is used as the final scaling factor, and the bottle image from the corresponding viewpoint is marked as a low-confidence frame.

[0013] By adopting the above technical solution, the initial scaling factor is iteratively corrected based on the clarity evaluation value of gradient information, so that the scaling factor can adaptively converge to a better value when the vibration conditions change, and low confidence frames are marked when the iteration fails to converge, which helps to ensure the adaptability of deformation compensation parameters under different vibration conditions.

[0014] Preferably, the images of each bottle are acquired within a phase window where the vibration velocity of the vibration signal is in a preset low-speed range, specifically including the following steps: The vibration signal is subjected to extreme value detection. When the extreme value point of the vibration signal is detected, a hardware trigger pulse is generated. The extreme value point corresponds to the phase position where the vibration displacement is the largest and the vibration velocity is the smallest. When the vibration signal is within the zero-crossing phase window corresponding to the maximum vibration velocity range, the generation of the hardware trigger pulse is suppressed, and the acquisition of the current frame is skipped.

[0015] By adopting the above technical solution, extreme value detection is performed on the vibration signal. A hardware trigger pulse is generated at the phase position where the vibration displacement is the largest and the vibration velocity is the smallest, and the trigger pulse in the range of maximum vibration velocity is suppressed. This allows the bottle image to be acquired within the phase window where the vibration velocity is in the low-speed range, which helps to reduce the impact of vibration on image quality from the source.

[0016] Preferably, the step of assigning confidence weights to the reference points from each viewpoint based on the spatial projection relationship between the image positions of each reference point and the vibration velocity vector specifically includes the following steps: The vibration acceleration signal is integrated within a preset time window to obtain the vibration velocity vector in the physical space; The vibration velocity vector of the physical space is projected onto the image space through camera calibration parameters to obtain the vibration velocity vector of the image space. For each reference point, the projection component of the image space vibration velocity vector along the extraction direction of that reference point is calculated; the reference points include the horizontal reference point and the vertical reference point. The confidence weight of the reference point is determined based on the projection components, and the absolute value of the projection components is negatively correlated with the confidence weight.

[0017] By adopting the above technical solution, the physical space vibration velocity vector is projected onto the image space and its projection component along the extraction direction of the reference point is calculated. The weights are allocated in a way that the absolute value of the projection component is negatively correlated with the confidence weight, so that the reference point less affected by vibration can obtain a higher weight in the solution, which helps to improve the solution accuracy of global center coordinates and rotation angle.

[0018] Preferably, after obtaining the longitudinal reference point, the following steps are further included: During a preset time period when the bottle body passes through the detection station, multiple sets of longitudinal reference points corresponding to the same bottle cap support ring under different vibration phases are obtained; Calculate the correlation coefficient between the temporal changes of multiple sets of the longitudinal reference points and the phase of the vibration signal; When the correlation coefficient is higher than the preset correlation threshold, the longitudinal reference point component that changes periodically with the vibration phase is identified as a pseudo-tilt component caused by vibration and is removed to obtain a pseudo-tilt corrected longitudinal reference point; the pseudo-tilt corrected longitudinal reference point is used for the confidence weight allocation and the calculation of the global center coordinates and rotation angle. When the correlation coefficient is lower than the preset correlation threshold, the longitudinal reference point is determined to be the true tilt of the support ring, and the tilt determination result of the support ring is output. The tilt determination result includes calculating the difference between the left and right Y coordinates of the longitudinal reference point that is determined to be tilted in each viewpoint, and obtaining the support ring tilt angle indication; when the support ring tilt angle indication in any viewpoint exceeds the preset tilt threshold, it is determined that the bottle has a tightening abnormality. The longitudinal reference point corresponding to the viewpoint where the scaling factor exceeds the preset range is not included in the calculation of the support ring tilt angle indication.

[0019] By adopting the above technical solution, the correlation coefficient between the temporal changes of multiple sets of longitudinal reference points and the phase of the vibration signal is calculated. The component that changes periodically with the vibration phase is identified as a pseudo-tilt and is removed. This ensures that the longitudinal reference points participating in the subsequent calculation are the results after pseudo-tilt correction, which helps to distinguish between the true tilt of the support ring and the pseudo-tilt caused by vibration and reduces the misjudgment rate.

[0020] Preferably, the bottle cap defect detection includes at least one of color consistency detection, high cap grayscale detection, and broken ring grayscale standard deviation detection, wherein the broken ring grayscale standard deviation detection includes the following steps: In the bottle cap local coordinate system, the left detection frame, the middle detection frame, and the right detection frame are sequentially set along the circumferential direction in the bottle cap broken ring area; Calculate the grayscale standard deviation of the pixel grayscale values ​​within each detection frame; When any of the grayscale standard deviations is greater than the first threshold and the difference between the grayscale standard deviation and the grayscale standard deviation of the adjacent detection frame is greater than the second threshold, it is determined that there is a broken ring gap in the bottle cap. The first threshold and the second threshold are adaptively adjusted according to the deformation compensation parameters; when the deviation of the deformation compensation parameters exceeds the preset range, the bottle image at the corresponding viewpoint is marked as a low-confidence frame, and the corresponding bottle is marked as a product to be re-inspected.

[0021] By adopting the above technical solution, three detection frames (left, middle, and right) are set in the broken ring area of ​​the bottle cap, and the gray scale standard deviation is calculated for each frame. The absolute value of the gray scale standard deviation and the difference between adjacent frames are used as the judgment conditions. The threshold is adaptively adjusted according to the deformation compensation parameter, which helps to improve the detection reliability of broken ring type micron-level gap defects.

[0022] Preferably, the step of back-projecting the candidate liquid surface lines from each viewpoint to three-dimensional space based on the global center coordinates and the rotation angle to perform coplanarity verification, and then removing artifacts and determining the liquid level height based on the verification results, specifically includes the following steps: The candidate lines of the liquid surface from each viewpoint are combined with the global center coordinates and the rotation angle and back-projected into three-dimensional space to obtain the three-dimensional liquid surface points corresponding to each viewpoint. By fitting a spatial plane with multiple three-dimensional liquid surface points, the angle between the normal vector of the spatial plane and the preset gravity direction vector is calculated; When the included angle is less than a preset coplanar threshold, the candidate liquid surface line is determined to be the real liquid surface, and the average height of the multiple three-dimensional liquid surface points is taken as the liquid level height. When the included angle is greater than or equal to the preset coplanar threshold, it is determined that there is artifact interference, liquid surface candidate lines with local gradient variance less than the preset variance threshold are removed, and the remaining liquid surface candidate lines are used to refit the spatial plane and determine the liquid level height. If the number of remaining candidate liquid level lines after refitting is less than the preset number, a liquid level detection failure signal is output, and the corresponding bottle is marked as an item to be re-inspected.

[0023] By adopting the above technical solution, candidate lines of liquid surface from various perspectives are back-projected to three-dimensional space and fitted to a spatial plane. The angle between the plane normal vector and the gravity direction is used as the basis for coplanarity verification. When the angle exceeds the limit, candidate lines with small local gradient variance are removed and refitted. This helps to suppress artifacts caused by interference such as reflection and bubbles, and improve the accuracy of liquid level height determination.

[0024] A bottle cap and liquid level detection system includes the following modules: The image acquisition module includes four color cameras spaced circumferentially above the bottle conveyor line, and a light source array corresponding to each of the color cameras, for synchronously acquiring bottle images from multiple perspectives. An inertial sensing module includes a vibration sensor deployed on the base of the bottle conveyor line for collecting vibration signals from the bottle conveyor line acting on the bottle. A detection device includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed as described in any of the preceding methods; The rejection actuator is deployed downstream of the bottle conveyor line and connected to the detection device. It is used to reject unqualified products based on the comprehensive detection results output by the detection device.

[0025] In summary, this application has the following beneficial effects: (1) This application uses vibration signals to control the timing of exposure acquisition, correct template matching and allocate the confidence weight of reference points, forming a closed-loop detection link that combines time domain and spatial domain vibration resistance, which helps to improve the overall accuracy of bottle cap tightness and liquid level detection under high-speed vibration conditions. (2) This application, through the coordinated efforts of pseudo-tilt elimination and multi-view coplanarity verification, ensures that both the longitudinal reference point and the candidate liquid surface line undergo reliability screening before participating in spatial calculation, which helps to reduce the impact of vibration interference and artifacts on the misjudgment of the detection results. (3) This application reuses the deformation compensation parameters in multiple stages of template correction, confidence weight allocation and detection threshold adjustment, so that the same vibration sensing result runs through the entire process of image correction, spatial calculation and defect detection, which helps to improve the adaptability and stability of the detection method under different vibration conditions. Attached Figure Description

[0026] Figure 1 This is a flowchart of a bottle cap and liquid level detection method according to this embodiment; Figure 2 This is a timing diagram of vibration triggering and image acquisition for a bottle cap and liquid level detection method in this embodiment; Figure 3 This is a flowchart of the liquid level coplanarity verification process for a bottle cap and liquid level detection method in this embodiment; Figure 4 This is a flowchart of a bottle cap defect detection method according to an embodiment of the bottle cap and liquid level detection method; Figure 5 This is an architectural diagram of a bottle cap and liquid level detection system in this embodiment. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0028] This application provides a method for detecting bottle caps and liquid levels, applied to a detection system including at least four color cameras, a light source array, and a vibration sensor. The at least four color cameras are spaced circumferentially above the bottle conveyor line, covering the entire circumference of the bottle. The light source array is correspondingly positioned to each color camera. The vibration sensor is mounted on the base of the bottle conveyor line.

[0029] like Figure 1 As shown, the method includes the following steps: S1. Acquire bottle images from multiple perspectives and synchronous vibration signals captured by a color camera. Each bottle image is acquired within a phase window where the vibration velocity of the vibration signal is within a preset low-speed range.

[0030] In one embodiment of this application, four color cameras are used, deployed at 90° intervals along the circumference above the bottle conveyor line. The optical axis of each camera points vertically downwards, covering a 90° field of view. The four cameras seamlessly stitch together, covering the entire 360° circumference of the bottle. As an example, a Basler acA2440-75um industrial color camera can be used to acquire images synchronously at 60fps. Each color camera is equipped with an independently controllable LED light source array. Two cameras use 45° annular diffused white light illumination (color temperature 5500K) to capture the RGB texture details of the bottle cap, while the other two use a combination of axial coaxial red light (center wavelength 630nm) and lateral blue light to enhance the reflective features of the support ring metal and the contrast of the top edge of the bottle cap. The type, color temperature, and wavelength of the light source can be adjusted according to the specific requirements of the bottle cap color, bottle material, and inspection items, and are not limited to the parameters mentioned above.

[0031] The vibration sensor uses a triaxial MEMS accelerometer (e.g., ADXL355) with a sampling rate of 1kHz to acquire the Z-axis vibration signal of the bottle conveyor base in real time. The Z-axis is along the height of the bottle.

[0032] Among them, such as Figure 2 As shown, the images of each bottle are acquired within a phase window where the vibration velocity of the vibration signal is in a preset low-speed range. The specific steps include the following: The vibration signal is subjected to extreme value detection. When the extreme value point of the vibration signal is detected, a hardware trigger pulse is generated. The extreme value point corresponds to the phase position where the vibration displacement is the largest and the vibration velocity is the smallest. When the vibration signal is within the zero-crossing phase window corresponding to the maximum vibration velocity range, the generation of hardware trigger pulses is suppressed, and the acquisition of the current frame is skipped.

[0033] In one embodiment, extreme value detection is performed on the vibration acceleration signal acquired by the vibration sensor. Specifically, the vibration acceleration signal is integrated to obtain a vibration velocity signal, and zero-crossing detection is performed on the vibration velocity signal. When the vibration velocity signal crosses zero, corresponding to the phase position of maximum vibration displacement and minimum vibration velocity, a hardware trigger pulse is generated to trigger the four color cameras to simultaneously acquire images. When the vibration velocity signal is near its maximum value (i.e., when the vibration acceleration signal crosses zero), corresponding to the phase window of maximum vibration velocity, the generation of the hardware trigger pulse is suppressed, and the acquisition of the current frame is skipped.

[0034] As a specific implementation of extreme value detection, the amplitudes of three adjacent sampling points are compared: if the amplitude of the previous point is less than the amplitude of the current point and the amplitude of the current point is greater than the amplitude of the next point, the current point is determined to be a maximum point; if the amplitude of the previous point is greater than the amplitude of the current point and the amplitude of the current point is less than the amplitude of the next point, the current point is determined to be a minimum point. A hardware trigger pulse is generated when a maximum or minimum point is detected.

[0035] It is understandable that, regardless of whether it is the three-point comparison method or zero-crossing detection, confirming the extreme point or zero-crossing point from the sampled signal requires data from at least one sampling period after that moment. Therefore, the issuance of the trigger pulse has an inherent detection lag relative to the theoretical extreme point. To eliminate the impact of this lag on image quality, this embodiment further employs a phase prediction triggering mechanism: based on the vibration dominant frequency fm extracted in step S22, the next extreme point is predicted using the following formula: t_next=t_detect+T / 2-Δt_delay; Where t_detect is the detection time of the current extreme point or zero-crossing point, T=1 / fm is the vibration period, the time interval between the extreme point and the adjacent zero-crossing point is T / 2, and Δt_delay is the sum of the transmission delay of the trigger pulse and the camera exposure response delay, obtained through actual measurement and calibration of the detection link. The processor sends out the hardware trigger pulse in advance according to the predicted time t_next, so that the center time of the camera exposure is aligned with the phase position of the vibration velocity zero-crossing. After calibration, the above mechanism can control the residual vibration velocity within 5% of the theoretical extreme velocity.

[0036] In another specific implementation, threshold comparison triggering can also be used: the absolute value of the vibration acceleration signal is taken, and a trigger pulse is immediately generated when the absolute value crosses a preset acceleration threshold. Since the point where the acceleration amplitude is at its maximum corresponds to the vicinity of zero velocity, the moment of crossing the threshold also falls within the low-velocity phase window, and the threshold comparison does not require waiting for confirmation from subsequent sampling points, there is no detection lag as mentioned above. In practical applications, phase prediction triggering and threshold comparison triggering can be used alone or in combination. For example, threshold comparison triggering can be used as the trigger source, and the phase prediction mechanism can be used to feedforward correct the triggering time.

[0037] Furthermore, since there is a half-cycle interval between two adjacent trigger pulses, adjacent trigger frames correspond to the positive and negative extreme values ​​of vibration displacement, respectively, and the deformation of the bottle caused by vibration is in opposite directions in adjacent frames. This phase complementarity characteristic provides a sampling basis for the cross-phase statistical analysis in the subsequent step S34.

[0038] S2. Determine the deformation compensation parameters based on the vibration signal, which includes the following steps: S21. A vibration acceleration signal along the height of the bottle is collected by a vibration sensor, which is installed on the base of the bottle conveyor line.

[0039] S22. Perform frequency domain analysis on the vibration acceleration signal to extract the dominant vibration frequency and its amplitude.

[0040] In one embodiment, at the trigger time of each frame image acquisition, a vibration acceleration signal data segment of 10ms prior to the trigger time is read. A Fast Fourier Transform (FFT) is performed on this data segment to identify the lowest frequency point with an energy share exceeding 40% as the dominant vibration frequency fm, and the amplitude A (unit: gravitational acceleration g) corresponding to this dominant frequency is extracted.

[0041] S23. Map the main frequency amplitude to a scaling factor to obtain deformation compensation parameters that include the scaling factor. This specifically includes the following steps: S231. Determine the foundation deformation coefficient corresponding to the frequency band to which the vibration main frequency belongs, and obtain the initial scaling factor based on the product of the foundation deformation coefficient and the main frequency amplitude.

[0042] In one embodiment, the base deformation coefficient α corresponding to the dominant vibration frequency fm is obtained by looking up a table: when fm is in [20, 50) Hz, α = 0.8; when fm is in [50, 100) Hz, α = 1.0; when fm is in [100, 150] Hz, α = 1.2. The initial scaling factor k0 is calculated as 1 + α × 0.002 × A.

[0043] S232. Calculate the sharpness evaluation value based on gradient information for the support ring region image obtained after deformation correction and matching.

[0044] As one way to implement the sharpness evaluation value, the Tenengrad function can be used: calculate the Sobel gradient in the horizontal and vertical directions for the support ring region image, and use the sum of the squared gradients of each pixel as the sharpness evaluation value.

[0045] As an alternative implementation, the Brenner function can be used: it calculates the sum of squares of the grayscale differences between two adjacent pixels as a sharpness evaluation value.

[0046] Alternatively, Laplacian variance can be used: perform Laplacian convolution on the image and take the variance of the convolution result as the sharpness evaluation value.

[0047] S233. When the sharpness evaluation value does not meet the preset convergence condition, the initial scaling factor is iteratively corrected according to the preset step size (e.g., 0.02) and the template matching is re-executed until the sharpness evaluation value meets the preset convergence condition or reaches the preset number of times (e.g., 5 times).

[0048] In one embodiment, the preset convergence condition is that the sharpness evaluation value is greater than or equal to a preset sharpness upper limit, and the change in the sharpness evaluation value after two adjacent iterations is less than a preset change threshold. When the sharpness evaluation value reaches a stable level and is higher than the preset sharpness upper limit, it indicates that the texture alignment between the template and the support ring region image under the current scaling factor has reached convergence, and the iteration is determined to be converged.

[0049] If the preset convergence condition is not met even after reaching the preset limit of attempts, the initial scaling factor is used as the final scaling factor, and the bottle image at the corresponding viewpoint is marked as a low-confidence frame. The detection results of the low-confidence frames are not used for subsequent support ring tilt determination.

[0050] In one embodiment, prior to extracting the reference point, image preprocessing is performed on the color images from each viewpoint, specifically including geometric correction and brightness normalization: Geometric correction corrects the distortion of each frame of the image based on the lens distortion parameters obtained in advance through camera calibration, eliminating the radial and tangential distortion of the wide-angle lens; Brightness normalization involves stretching the grayscale histogram or performing gain equalization on images from each viewing angle to eliminate differences in light output from various light source arrays and uneven illumination caused by the different positions of the bottle within the field of view. This ensures that the grayscale distribution of images from each viewing angle is normalized to a consistent dynamic range. The preprocessed images are then used for subsequent reference point extraction, template matching, and defect detection.

[0051] S3. For the bottle image from each viewpoint, extract the center points of the left and right edges of the bottle cap to obtain the horizontal reference points; perform correction matching and inverse correction on the matching templates of the left and right regions of the bottle cap support ring according to the deformation compensation parameters to obtain the vertical reference points, specifically including the following steps.

[0052] S31. In one embodiment, a digital caliper edge detection operator scans the upper edge area of ​​the bottle cap horizontally, extracting a continuous high-gradient edge line on each of the left and right sides. The geometric center point of the two edge lines is taken as the lateral reference point from that viewpoint. As an example, the caliper tool uses sub-pixel Canny edge detection combined with Hough line fitting, achieving an edge positioning accuracy of 0.3 pixels.

[0053] S32. Scale the matching template according to the scaling factor, and perform normalized cross-correlation template matching on the left and right regions of the bottle cap support ring respectively to obtain the matching center coordinates of the left region and the matching center coordinates of the right region.

[0054] In one embodiment, the left and right region templates of the support ring are preprocessed by horizontal scaling by a scaling factor k. Then, normalized cross-correlation template matching (NCC) is performed on the left and right regions of the support ring to obtain the coordinates (x, y) of the matching center of the left region. L ,y L ) and the right region matching center coordinates (x R ,y R ).

[0055] S33. Scale the left and right region matching center coordinates by the reciprocal of the scaling factor 1 / k to restore them to the original image coordinate system and obtain the vertical reference point.

[0056] Support ring template matching can be achieved using SIFT feature point matching. The template library contains multi-pose samples of various common support rings to cover the geometric differences of support rings for different bottle shapes.

[0057] After obtaining the longitudinal reference point, the following steps are also included: S34. Within a preset time period when the bottle passes through the detection station, obtain multiple sets of longitudinal reference points corresponding to the same bottle cap support ring under different vibration phases.

[0058] In one embodiment, the preset time period is the time period during which the bottle passes through the complete field of view of the four cameras.

[0059] Multiple sets of longitudinal reference points can be obtained using one or a combination of the following methods: Utilizing the phase complementarity of adjacent trigger frames in step S1: adjacent trigger frames correspond to the positive and negative extreme values ​​of vibration displacement, respectively, and the vibration deformation directions are opposite. The longitudinal reference points extracted from each trigger frame naturally constitute multiple sets of samples under different vibration phases. A small region of interest (ROI) is set in the support ring area. When the bottle passes through the field of view of a single camera, 4 to 8 frames are taken in burst mode at a higher frame rate than usual. Each frame corresponds to a different vibration phase. This method does not reduce the conveyor line speed. The inspection station refers to the inspection section on the bottle conveyor line defined by the field of view of each color camera. The collection and inspection begin as soon as the bottle enters this section.

[0060] In a specific example, the above multi-frame acquisition and statistical correction are completed within a single bottle detection cycle of approximately 200ms, meeting the production line cycle time requirements.

[0061] S35. Calculate the correlation coefficient between the temporal changes of multiple sets of longitudinal reference points and the phase of the vibration signal.

[0062] Specifically, for each frame of the image, the difference ΔY between the Y coordinates of the left and right regions of the support ring is calculated. i =y Li -y Ri The time series sequence of Y-coordinate differences between the longitudinal reference points is obtained as {ΔY1, ΔY2, ..., ΔY}. n} Where n is the number of image frames acquired within the preset time period, and n is not less than 6. If the number of frames is insufficient, the support ring area is supplemented by burst shooting.

[0063] Simultaneously, the vibration acceleration signal is preprocessed by removing the mean and linear trend, and then integrated twice to obtain the vibration displacement signal, in order to suppress the drift components formed by the accumulation of sensor zero bias and low-frequency drift. The vibration displacement signal is then linearly interpolated according to the time points corresponding to the exposure times of each frame of the image, and the vibration displacement values ​​at each exposure time are taken to form a vibration displacement time sequence {s1, s2, ..., s...}. n}

[0064] Calculate the Pearson correlation coefficient ρ between the two time series mentioned above: ; in, Let be the mean of the ΔY sequence. Let be the mean of the s sequence.

[0065] Before performing correlation determination, vibration amplitude threshold verification is performed: when the main frequency amplitude A extracted in step S22 is lower than the preset amplitude threshold, it is determined that the current vibration is insufficient to generate an observable pseudo tilt component, the correlation test is skipped, and the longitudinal reference point is directly treated as the actual tilt of the support ring; when the main frequency amplitude A is not lower than the preset amplitude threshold, the following determination is performed.

[0066] S36. When the correlation coefficient ρ is higher than the preset correlation threshold (e.g., 0.85), the Y-coordinate difference changes synchronously with the vibration displacement. This difference contains a pseudo-tilt component caused by vibration, which is removed as follows: With vibration displacement sequence {s i} is the sequence of y-coordinate differences, where ΔY is the independent variable. i Perform a univariate linear least squares fit on the dependent variable to obtain the proportionality coefficient β, where β represents the magnitude of the pseudo-tilt component. Subtract β·s from the Y coordinate of the left region of each frame i / 2. Add β·s to the Y-coordinate of the right region i / 2, that is, removing the pseudo-tilt component that changes periodically with the vibration phase from the longitudinal reference point to obtain the longitudinal reference point after pseudo-tilt correction.

[0067] The longitudinal reference point, after pseudo-tilt correction, is used for confidence weight allocation and the calculation of global center coordinates and rotation angles.

[0068] In another specific implementation, the removal of pseudo-tilt components can also employ an extreme value frame cancellation method: Take one frame near each of the positive and negative extreme values ​​of the vibration displacement (i.e., two adjacent trigger frames with opposite vibration deformation directions), average the Y-coordinates of the left and right regions of the two frames, and then, since the sinusoidal pseudo-tilt components are equal in value and opposite in sign at opposite phases, they cancel each other out after averaging, resulting in the corrected longitudinal reference point. This method requires no regression fitting, minimizes computation, and is suitable for situations with a small number of sample frames.

[0069] When the correlation coefficient ρ is lower than the preset correlation threshold, the difference in the Y coordinate of the longitudinal reference point is determined to be unrelated to the vibration displacement, that is, the difference is the true tilt of the support ring, and the tilt determination result of the support ring is output. The longitudinal reference point retains its original value and participates in the confidence weight allocation and the calculation of the global center coordinate and rotation angle.

[0070] In one embodiment, the tilt determination result includes: calculating the difference ΔY=y between the Y-coordinate of the left region and the Y-coordinate of the right region of the longitudinal reference point determined to be a true tilt under each viewpoint. L -y R The tilt angle of the support ring is obtained.

[0071] When the tilt angle of the support ring at any viewpoint exceeds the preset tilt threshold (e.g., 0.5mm), it is determined that there is an abnormal tightening of the bottle.

[0072] The preset coefficient range can be determined based on the standard geometric dimensions of the support ring. For example, the allowable range for the scaling factor k is [0.96, 1.04]. When the final scaling factor of a certain viewpoint falls outside this range, it indicates that the deformation compensation amount of that viewpoint deviates from the calibration range, and the corresponding image deformation compensation reliability is insufficient. The longitudinal reference point corresponding to this viewpoint will not participate in the calculation of the support ring tilt angle indication to avoid tilt misjudgment caused by unreliable reference points.

[0073] S4. Based on the spatial projection relationship between the image position of each reference point and the vibration velocity vector, assign confidence weights to the reference points of each viewpoint, calculate the global center coordinates and rotation angle of the bottle body based on the confidence weights, and reconstruct the local coordinate system of the bottle cap. The specific steps include the following.

[0074] S41. Integrate the vibration acceleration signal within a preset time window (e.g., 10ms) to obtain the vibration velocity vector in the physical space.

[0075] In one embodiment, the vibration acceleration signal is first high-pass filtered to suppress low-frequency drift and DC bias before integration. Since the time window used for integration is short (e.g., 10ms), the effect of sensor zero drift on the integration result within the short time window can be ignored. Alternatively, a relative integration method with the velocity set to zero at the beginning of each window can be used.

[0076] It should be noted that although each frame of the image was acquired within the phase window where the vibration velocity was in the low-speed range, the residual vibration velocity at the time of exposure was not zero due to the time lag and jitter in the triggering link. Furthermore, the degree to which each reference point was affected by the residual vibration velocity varied depending on its position in the image and the extraction direction.

[0077] S42. Project the vibration velocity vector in the physical space onto the image space through the camera calibration parameters to obtain the vibration velocity vector in the image space.

[0078] S43. For each reference point, calculate the projection component of the image space vibration velocity vector along the extraction direction of that reference point. The reference points include horizontal reference points and vertical reference points.

[0079] S44. Determine the confidence weight of the reference point based on the projection components. The absolute value of the projection components is negatively correlated with the confidence weight, that is, the larger the absolute value of the projection components, the smaller the confidence weight.

[0080] For example, the confidence weight w = 1 / (1 + |v·d|), where v is the spatial vibration velocity vector of the image and d is the unit vector of the extraction direction of the reference point.

[0081] S45. Construct a weighted projection error objective function according to the confidence weight, and solve the global center coordinates and rotation angle of the bottle by minimizing the weighted projection error objective function.

[0082] In one embodiment, a PnP solver is used, with the cylindrical surface of the bottle as the reference model. Sixteen reference points from four different viewpoints are input, and the global center coordinates and rotation angles with translational errors less than 0.08 mm and rotation errors less than 0.15° are output. The local coordinate system of the bottle cap is then reconstructed based on the global center coordinates and rotation angles.

[0083] S5. Based on the global center coordinates and rotation angle, backproject the candidate liquid surface lines from each viewpoint into three-dimensional space to perform coplanarity verification. Based on the verification results, remove artifacts and determine the liquid level height. Determine whether the liquid level in the bottle is acceptable based on the liquid level height. Figure 3 As shown, the specific steps include the following: S51. In one embodiment, the candidate liquid level line is extracted as follows: Within the liquid level detection area of ​​the bottle wall in images from various perspectives, the mean gray level or gray level gradient of each row is calculated along the row direction of the image. Due to the boundary between liquid and gas, a sudden change in brightness occurs at the liquid surface. Rows with gradient amplitudes exceeding a preset edge threshold are identified as candidate liquid surface rows. Subpixel-level straight line fitting is performed on continuous candidate liquid surface rows to obtain the candidate liquid surface line under that perspective.

[0084] To address the issues of foam layers, air bubbles, and water stains reflecting off the bottle walls in carbonated beverages, a preferred implementation method employs a multi-row voting mechanism to enhance the robustness of candidate line extraction. This involves dividing the liquid level detection area vertically into multiple sub-windows, extracting candidate edge rows within each sub-window, and identifying edge rows that appear more frequently than a preset number of votes as valid candidate lines. This suppresses the misidentification of isolated reflective bright lines and foam layer boundaries as liquid surfaces. Alternatively, inter-frame temporal filtering can be used to extract candidate lines from multiple frames of the same bottle image and select those with temporal consistency, eliminating transient candidate lines caused by occasional reflections.

[0085] S52. Combine the candidate liquid surface lines from each viewpoint with the global center coordinates and rotation angles and back-project them into three-dimensional space to obtain the three-dimensional liquid surface points corresponding to each viewpoint.

[0086] S53. Fit a spatial plane to multiple three-dimensional liquid surface points and calculate the angle between the normal vector of the spatial plane and the preset gravity direction vector.

[0087] It is understandable that after the liquid surface is refracted by the cylindrical bottle wall and imaged by the camera, directly projecting the candidate lines of the liquid surface in the image onto three-dimensional space using a linear propagation model will result in a systematic height deviation of the three-dimensional liquid surface points obtained from different viewpoints, which varies with the viewpoint. To eliminate this deviation, this embodiment adopts the following refraction offset compensation method: During the equipment calibration phase, standard bottles containing standard liquid are used to acquire images from various perspectives at multiple known liquid levels. The difference between the back-projected height and the actual liquid level at each perspective and each liquid level is obtained using the back-projection method described above. A refraction offset compensation table indexed by perspective and liquid level is generated. During actual testing, after obtaining the three-dimensional liquid surface point through back-projection, the height value of the point is corrected according to the compensation table, and then coplanarity fitting is performed.

[0088] S54. When the included angle is less than the preset coplanar threshold (e.g., 5°), the candidate liquid surface line is determined to be the real liquid surface, and the average height of multiple three-dimensional liquid surface points is taken as the liquid level height. When the included angle is greater than or equal to the preset coplanar threshold, it is determined that there is artifact interference. Liquid surface candidate lines with local gradient variance less than the preset variance threshold (e.g., 10) are removed. The remaining liquid surface candidate lines are used to refit the spatial plane and determine the liquid level height.

[0089] S55. When the number of remaining candidate lines for liquid level after refitting is less than the preset number (e.g., 2 lines), output a liquid level detection failure signal and mark the corresponding bottle as a product to be re-inspected.

[0090] S56. Determine whether the liquid level of the bottle is qualified based on the comparison between the liquid level height and the preset liquid level range. For example, when the liquid level height is lower than the preset lower limit, it is determined that the filling volume is insufficient; when the liquid level height is higher than the preset upper limit, it is determined that the filling volume is excessive.

[0091] S6, such as Figure 4 As shown, bottle cap defect detection is performed in the local coordinate system of the bottle cap, and the output is a comprehensive detection result including the liquid level height and the bottle cap defect detection result.

[0092] Bottle cap defect detection includes at least one of the following: color consistency detection, high cap grayscale detection, and broken ring grayscale standard deviation detection.

[0093] S61. In one embodiment, color consistency detection includes: setting 5×5 pixel detection windows on the left and right sides of the top of the bottle cap in the local coordinate system of the bottle cap, extracting the average RGB value within the window, and comparing it with the Lab color gamut threshold of the standard color card. As an example, the DIN99o color difference formula is used, and the color difference tolerance ΔE ≤ 3.5.

[0094] S62. High cap grayscale detection includes: setting a 10×10 pixel detection area above the center of the top of the bottle cap, calculating the average grayscale value in the area, and if it is lower than the preset grayscale lower limit (e.g., 85), it is determined to be a high cap.

[0095] S63. The detection of the standard deviation of grayscale in S63 includes the following steps: S631. In the bottle cap local coordinate system, set the left detection box, the middle detection box and the right detection box in sequence along the circumference of the bottle cap broken ring area; each detection box is 3×8 pixels.

[0096] S632. Calculate the standard deviation of grayscale values ​​of pixels within each detection frame: standard deviation of grayscale values ​​of the left detection frame σ L σ, the standard deviation of grayscale in the detection frame M σ, the standard deviation of grayscale in the right detection frame R .

[0097] S633. When any grayscale standard deviation is greater than the first threshold (e.g., 12) and the difference between the grayscale standard deviation and the grayscale standard deviation of the adjacent detection frame is greater than the second threshold (e.g., 8), it is determined that there is a broken ring gap in the bottle cap.

[0098] The first threshold and the second threshold are adaptively adjusted according to the deformation compensation parameters.

[0099] When the deviation of the deformation compensation parameters exceeds the preset range, the bottle image at the corresponding viewpoint is marked as a low-confidence frame, and the corresponding bottle is marked as a product to be re-inspected.

[0100] In one embodiment, the first threshold and the second threshold were obtained through actual testing and calibration on 2000 bottles. The calibration showed that a first threshold of 12 corresponds to a 0.15mm annular gap, and a second threshold of 8 effectively distinguishes the grayscale fluctuations between the broken ring gap and the surface of the normal support ring.

[0101] The output includes a comprehensive inspection result that includes information on liquid level and cap defect detection. This comprehensive inspection result is used to control the rejection mechanism to remove non-conforming products.

[0102] In another embodiment, the bottle cap defect detection also includes skew detection: in the local coordinate system of the bottle cap, the center points of the edges on the left and right sides of the top of the bottle cap are extracted, and the difference in Y coordinate between the center points of the two edges is calculated. When the difference in Y coordinate exceeds the preset skew tolerance, it is determined that the bottle cap has a skew defect.

[0103] Based on the same inventive concept described above, this application also discloses a bottle cap and liquid level detection system, such as... Figure 5 As shown, it includes the following modules: The image acquisition module includes four color cameras spaced circumferentially above the bottle conveyor line, and a light source array corresponding to each color camera, for synchronously acquiring bottle images from multiple perspectives. An inertial sensing module, including a vibration sensor deployed on the base of the bottle conveyor line, is used to collect vibration signals from the bottle conveyor line acting on the bottle. The detection device includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed as described above for the bottle cap and liquid level detection method. The rejection actuator is located downstream of the bottle conveyor line and connected to the testing device. It is used to reject defective products based on the comprehensive test results output by the testing device.

[0104] This application also provides a computer-readable storage medium storing a computer program that can be loaded by a processor and executed in the above-described bottle cap and liquid level detection method. The computer-readable storage medium includes, for example, various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory, random access memory, magnetic disk, or optical disk.

[0105] The above embodiments are only used to provide a detailed description of the technical solutions of this application. However, the description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application, and should not be construed as a limitation of this application. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application.

Claims

1. A method for detecting bottle caps and liquid levels, characterized in that, An application to a detection system comprising at least four color cameras, a light source array, and a vibration sensor, wherein the at least four color cameras cover the entire circumference of the bottle, the method comprising the following steps: Multiple bottle images and synchronous vibration signals are acquired from different perspectives by the color camera, and each bottle image is acquired within a phase window where the vibration velocity of the vibration signal is in a preset low-speed range. Deformation compensation parameters are determined based on the vibration signal; For the bottle image from each viewpoint, the center points of the left and right edges of the bottle cap are extracted to obtain the lateral reference points; the matching templates of the left and right regions of the bottle cap support ring are corrected and matched and reversed according to the deformation compensation parameters to obtain the longitudinal reference points. Based on the spatial projection relationship between the image position of each reference point and the vibration velocity vector, the confidence weight of the reference points for each viewpoint is assigned, and the global center coordinates and rotation angle of the bottle are calculated based on the confidence weights, and the local coordinate system of the bottle cap is reconstructed. Based on the global center coordinates and the rotation angle, the candidate lines of the liquid surface from each viewpoint are back-projected into the three-dimensional space to perform coplanarity verification. Based on the verification results, artifacts are removed and the liquid level height is determined. Based on the liquid level height, it is determined whether the liquid level of the bottle is qualified. Perform bottle cap defect detection in the local coordinate system of the bottle cap, and output a comprehensive detection result that includes the liquid level height and the bottle cap defect detection result.

2. The bottle cap and liquid level detection method according to claim 1, characterized in that, Determining the deformation compensation parameters based on the vibration signal specifically includes the following steps: The vibration sensor collects vibration acceleration signals along the height direction of the bottle body, and the vibration sensor is installed on the base of the bottle body conveyor line; Frequency domain analysis was performed on the vibration acceleration signal to extract the dominant vibration frequency and its amplitude. The main frequency amplitude is mapped to a scaling factor to obtain the deformation compensation parameter containing the scaling factor.

3. The bottle cap and liquid level detection method according to claim 2, characterized in that, The process of correcting and re-correcting the matching templates for the left and right regions of the bottle cap support ring based on the deformation compensation parameters to obtain the longitudinal reference point includes the following steps: The matching template is scaled according to the scaling factor, and normalized cross-correlation template matching is performed on the left and right regions of the bottle cap support ring to obtain the matching center coordinates of the left region and the matching center coordinates of the right region. The coordinates of the matching center of the left region and the coordinates of the matching center of the right region are scaled by the reciprocal of the scaling factor to restore them to the original image coordinate system, thus obtaining the vertical reference point.

4. The bottle cap and liquid level detection method according to claim 2, characterized in that, The step of mapping the main frequency amplitude to a scaling factor specifically includes the following steps: Determine the base deformation coefficient corresponding to the frequency band to which the vibration dominant frequency belongs, and obtain the initial scaling factor based on the product of the base deformation coefficient and the amplitude of the dominant frequency; Calculate a sharpness evaluation value based on gradient information for the support ring region image obtained after deformation correction; When the sharpness evaluation value does not meet the preset convergence condition, the initial scaling factor is iteratively corrected according to the preset step size and template matching is re-executed until the sharpness evaluation value meets the preset convergence condition or reaches the preset number of times limit; If the preset convergence condition is not met even after reaching the preset maximum number of attempts, the initial scaling factor is used as the final scaling factor, and the bottle image from the corresponding viewpoint is marked as a low-confidence frame.

5. The bottle cap and liquid level detection method according to claim 1, characterized in that, The images of each bottle are acquired within a phase window when the vibration velocity of the vibration signal is in a preset low-speed range, specifically including the following steps: The vibration signal is subjected to extreme value detection. When the extreme value point of the vibration signal is detected, a hardware trigger pulse is generated. The extreme value point corresponds to the phase position where the vibration displacement is the largest and the vibration velocity is the smallest. When the vibration signal is within the zero-crossing phase window corresponding to the maximum vibration velocity range, the generation of the hardware trigger pulse is suppressed, and the acquisition of the current frame is skipped.

6. The bottle cap and liquid level detection method according to claim 2, characterized in that, The step of assigning confidence weights to the reference points from each viewpoint based on the spatial projection relationship between the image position of each reference point and the vibration velocity vector specifically includes the following steps: The vibration acceleration signal is integrated within a preset time window to obtain the vibration velocity vector in the physical space; The vibration velocity vector of the physical space is projected onto the image space through camera calibration parameters to obtain the vibration velocity vector of the image space. For each reference point, the projection component of the image space vibration velocity vector along the extraction direction of that reference point is calculated; the reference points include the horizontal reference point and the vertical reference point. The confidence weight of the reference point is determined based on the projection components, and the absolute value of the projection components is negatively correlated with the confidence weight.

7. The bottle cap and liquid level detection method according to claim 3, characterized in that, After obtaining the longitudinal reference point, the following steps are also included: During a preset time period when the bottle body passes through the detection station, multiple sets of longitudinal reference points corresponding to the same bottle cap support ring under different vibration phases are obtained; Calculate the correlation coefficient between the temporal changes of multiple sets of the longitudinal reference points and the phase of the vibration signal; When the correlation coefficient is higher than the preset correlation threshold, the longitudinal reference point component that changes periodically with the vibration phase is identified as a pseudo-tilt component caused by vibration and is removed to obtain a pseudo-tilt corrected longitudinal reference point; the pseudo-tilt corrected longitudinal reference point is used for the confidence weight allocation and the calculation of the global center coordinates and rotation angle. When the correlation coefficient is lower than the preset correlation threshold, the longitudinal reference point is determined to be the true tilt of the support ring, and the tilt determination result of the support ring is output. The tilt determination result includes calculating the difference between the left and right Y coordinates of the longitudinal reference point that is determined to be tilted in each viewpoint, and obtaining the support ring tilt angle indication; when the support ring tilt angle indication in any viewpoint exceeds the preset tilt threshold, it is determined that the bottle has a tightening abnormality. The longitudinal reference point corresponding to the viewpoint where the scaling factor exceeds the preset range is not included in the calculation of the support ring tilt angle indication.

8. The bottle cap and liquid level detection method according to claim 1, characterized in that, The bottle cap defect detection includes at least one of color consistency detection, high cap grayscale detection, and broken ring grayscale standard deviation detection. The broken ring grayscale standard deviation detection includes the following steps: In the bottle cap local coordinate system, the left detection frame, the middle detection frame, and the right detection frame are sequentially set along the circumferential direction in the bottle cap broken ring area; Calculate the grayscale standard deviation of the pixel grayscale values ​​within each detection frame; When any of the grayscale standard deviations is greater than the first threshold and the difference between the grayscale standard deviation and the grayscale standard deviation of the adjacent detection frame is greater than the second threshold, it is determined that there is a broken ring gap in the bottle cap. The first threshold and the second threshold are adaptively adjusted according to the deformation compensation parameters; when the deviation of the deformation compensation parameters exceeds the preset range, the bottle image at the corresponding viewpoint is marked as a low-confidence frame, and the corresponding bottle is marked as a product to be re-inspected.

9. The bottle cap and liquid level detection method according to claim 1, characterized in that, The process of back-projecting candidate liquid surface lines from each viewpoint into three-dimensional space based on the global center coordinates and the rotation angle to perform coplanarity verification, and then removing artifacts and determining the liquid level height based on the verification results, specifically includes the following steps: The candidate lines of the liquid surface from each viewpoint are combined with the global center coordinates and the rotation angle and back-projected into three-dimensional space to obtain the three-dimensional liquid surface points corresponding to each viewpoint. By fitting a spatial plane with multiple three-dimensional liquid surface points, the angle between the normal vector of the spatial plane and the preset gravity direction vector is calculated; When the included angle is less than a preset coplanar threshold, the candidate liquid surface line is determined to be the real liquid surface, and the average height of the multiple three-dimensional liquid surface points is taken as the liquid level height. When the included angle is greater than or equal to the preset coplanar threshold, it is determined that there is artifact interference, liquid surface candidate lines with local gradient variance less than the preset variance threshold are removed, and the remaining liquid surface candidate lines are used to refit the spatial plane and determine the liquid level height. If the number of remaining candidate liquid level lines after refitting is less than the preset number, a liquid level detection failure signal is output, and the corresponding bottle is marked as an item to be re-inspected.

10. A bottle cap and liquid level detection system, characterized in that, Includes the following modules: The image acquisition module includes four color cameras spaced circumferentially above the bottle conveyor line, and a light source array corresponding to each of the color cameras, for synchronously acquiring bottle images from multiple perspectives. An inertial sensing module includes a vibration sensor deployed on the base of the bottle conveyor line for collecting vibration signals from the bottle conveyor line acting on the bottle. A detection device includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and execute the method as described in any one of claims 1 to 9; The rejection actuator is deployed downstream of the bottle conveyor line and connected to the detection device. It is used to reject unqualified products based on the comprehensive detection results output by the detection device.