A method and system for detecting vertical axis deviation of a pharmaceutical glass bottle based on an LSCM
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-21
- Publication Date
- 2026-08-11
AI Technical Summary
[0006]为克服现有垂直轴偏差检测技术中测量精度低、信息维度单一、依赖机械基准、抗干扰能力差以及对异形瓶适应性不足等缺陷,本发明提供一种基于LSCM的药用玻璃瓶垂直轴偏差检测方法及系统,通过多高度截面自适应采样、空间轴线全局一致性优化拟合以及端面法向自基准,实现高精度、多维度、无基准依赖的瓶口几何质量评估
首先,本发明将LSCM引入药用玻璃瓶垂直轴偏差检测领域,利用其纳米级纵向分辨率和光学层析能力,彻底突破了传统接触式千分表或单点激光位移传感器在测量精度上的瓶颈。通过采集高密度三维点云并进行亚微米级高度定位,本发明能够实现微米甚至亚微米量级的垂直轴偏差检测,远超现有技术0.01mm~0.1mm的精度水平,可满足预灌封注射器等高端药用玻璃包装对几何精度的严苛要求。同时,基于共聚焦原理的针孔滤波有效抑制了环境光、玻璃透射及表面反光的干扰,测量重复性和信噪比大幅提升。
Smart Images

Figure CN122544686A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of pharmaceutical packaging container quality inspection, and in particular relates to a method and system for detecting vertical axis deviation of pharmaceutical glass bottles based on laser scanning confocal microscopy (LSCM). Background Technology
[0002] Pharmaceutical glass vials (such as vials, ampoules, and pre-filled syringe glass assemblies) are packaging materials that come into direct contact with pharmaceuticals. The geometric accuracy of the vial opening and body directly affects the reliability of subsequent filling, capping, and sealing. Vertical axis deviation is a key quality indicator that measures the degree of deviation between the centerline of the vial opening and the centerline of the vial bottom or the theoretical axis of the vial body. Excessive vertical axis deviation can lead to inaccurate insertion of the filling needle, poor sealing of the rubber stopper, or uneven force during capping, resulting in serious quality problems such as drug leakage and microbial contamination. Therefore, domestic and international pharmaceutical packaging standards, such as YBB00192003-2015 "Vertical Axis Deviation Determination Method" and GB / T8452-2025 "Test Method for Vertical Axis Deviation of Glass Bottles and Jars," clearly stipulate the testing methods and tolerance ranges for vertical axis deviation.
[0003] Currently, most mainstream vertical axis deviation detection equipment uses the rotation method. Specifically, the glass bottle to be tested is upright and fixed on a high-precision rotating platform, with the measuring head of a contact dial indicator or a non-contact laser displacement sensor aligned with a fixed height approximately 2 mm below the bottle opening. As the rotating platform drives the bottle to rotate uniformly around its central axis at the bottom for one revolution, the sensor records the radial runout of the bottle opening's outer contour on this single horizontal cross-section. The vertical axis deviation is obtained by calculating half the difference between the maximum and minimum values. While some high-end equipment has achieved digital display and automatic calculation, the underlying principle of the entire detection process remains at the level of two-dimensional displacement measurement of a single circumferential cross-section.
[0004] However, in actual production and quality control, the aforementioned existing technologies have gradually revealed significant shortcomings. First, measurement accuracy is limited by the sensor's principle: contact dial indicators suffer from mechanical friction and force deformation, while non-contact laser displacement sensors are essentially still one-dimensional point measurements. Neither can consistently achieve sub-micron resolution, proving inadequate for the increasingly stringent precision requirements of high-end pharmaceutical glass bottles. Second, single-section measurement only reflects the radial offset at a specific height of the bottle opening, failing to reveal the overall orientation of the bottle opening axis in space. For example, overall bottle tilt and localized bottle opening bending may result in the same single-section deviation value, but the quality consequences are drastically different, and existing methods cannot distinguish between them. Furthermore, geometric parameters that also affect sealing performance, such as the flatness of the bottle opening end face, the axial tilt angle, and the concentricity between sections at different heights, cannot be obtained from a single circumferential runout data.
[0005] More critically, existing technologies heavily rely on the mechanical precision of the rotary platform itself. The measurement results are referenced to the central axis of the rotary table. If the rotary table has radial runout or axial misalignment, these errors will be directly coupled into the measured values. Therefore, expensive air bearings or ultra-high precision mechanical bearing rotary tables must be used. Furthermore, when the bottle neck surface has local features such as parting lines, microburrs, or raised markings, single-point or single-line sensors are prone to misinterpreting these local anomalies as overall eccentricity, leading to poor repeatability and a high false detection rate. For non-standard circular bottle necks or irregularly shaped bottles with difficult bottom positioning, existing standard methods explicitly state their limited applicability and lack effective universal solutions. Summary of the Invention
[0006] To overcome the shortcomings of existing vertical axis deviation detection technologies, such as low measurement accuracy, single information dimension, reliance on mechanical references, poor anti-interference ability, and insufficient adaptability to irregularly shaped bottles, this invention provides a vertical axis deviation detection method and system for pharmaceutical glass bottles based on LSCM. Through multi-height cross-section adaptive sampling, global consistency optimization fitting of spatial axis, and end face normal self-reference, it achieves high-precision, multi-dimensional, and reference-free evaluation of bottle mouth geometric quality.
[0007] Specifically, the technical solution provided by this invention is as follows: A method for detecting vertical axis deviation of pharmaceutical glass vials based on LSCM, comprising the following steps: Step S1: Pre-scanning and adaptive section planning The glass vial to be tested was fixed on a rotating stage, and a laser confocal scanning microscope was used to pre-scan along the axial direction of the vial opening to obtain the contour envelope of the region from the vial opening to the neck. R ( z ),in zThe axial distance from the bottle neck end face; the height positions of multiple measurement sections are adaptively determined according to the rate of curvature change of the contour envelope, so that the measurement sections are more densely packed in the region of large curvature change; Step S2: Acquisition of 3D point clouds of multiple sections and end faces At each measured section height, the rotary table is controlled to rotate in increments, and a single-point axial scan is performed at each angular position using a laser confocal scanning microscope. The surface height of the point is obtained by positioning the peak light intensity. Combined with the rotary table angle and the nominal radius of the section, the coordinates are converted to Cartesian coordinates to obtain the circumferential three-dimensional point cloud of each section. At the same time, a ring grid scan is performed on the upper end face of the bottle mouth to obtain the three-dimensional point cloud of the end face. Step S3: Extraction of end face normal reference The three-dimensional point cloud of the end face is filtered and denoised, and the end face plane is fitted using a random sampling consensus algorithm to obtain the unit normal vector of the end face plane. This normal vector is defined as the virtual vertical reference axis. Step S4: Global Consistency Spatial Axis Fitting The circular point cloud data of all the obtained cross sections are uniformly substituted into the global objective function, and the reference point coordinates, tilt angle, azimuth angle and radius of each cross section are solved simultaneously by the nonlinear least squares optimization algorithm to obtain the actual spatial axis of the bottle mouth. Step S5: Multi-dimensional deviation calculation and quality grading Based on the actual spatial axis and the virtual vertical reference axis, the vertical axis deviation, axis tilt angle, curvature, end face flatness and concentricity are calculated, and the quality of the glass bottle under test is graded according to the preset threshold.
[0008] Furthermore, the adaptive determination of the height positions of multiple measurement sections in step S1 specifically includes: For the contour envelope R ( z Perform smoothing filtering and cubic spline interpolation, and calculate its second derivative. Set curvature threshold e ,when | And when the length of a continuous interval exceeds the preset minimum encryption length, the measurement cross-section within that interval is encrypted so that the distance between adjacent cross-sections does not exceed the first spacing threshold; when When the cross-section is set according to the sparse sampling method, the spacing between adjacent cross-sections is the second spacing threshold, and the second spacing threshold is greater than the first spacing threshold.
[0009] Further, the single-point axial scan in step S2 includes: Centered on the current focusing position, the objective lens of the laser confocal scanning microscope is moved in nanometer-scale steps within a preset axial scanning range, and the reflected light intensity at each step position is recorded to form a light intensity sequence. After median filtering of the light intensity sequence, Gaussian fitting is used to locate the peak position of the light intensity, which is the surface height of the current point.
[0010] Furthermore, the extraction of the end face normal reference in step S3 specifically includes: Step S3-1: Statistical Filtering for Noise Reduction For end face point cloud For each point Search for its nearest preset number of neighboring points and calculate the average distance from that point to all its neighboring points. ; Calculate all mean and standard deviation Set the distance threshold to Points with an average distance greater than the threshold are removed to obtain the point cloud of the clean end face. Q clean ; Step S3-2: RANSAC plane fitting from Q clean Three non-collinear points are randomly selected from the data to determine the candidate plane equation. ,in For unit normal vector, d Let be the distance from the origin to the plane; calculate the distance from all other points to the plane. ,like If the distance is less than the preset distance threshold, the point is classified as an interior point; repeat the random sampling and interior point statistics process until the preset maximum number of iterations, record the candidate plane with the most interior points and its interior point set, and require that the number of interior points is not less than the preset minimum proportion of the total number of points; Step S3-3: Least Squares Refinement Plane Using the obtained set of interior points, the final plane is fitted using the least squares method, i.e., the following optimization problem is solved:
[0011] in L The total number of interior points; the optimal unit normal vector is obtained. and optimal plane constant and will n top Defined as a virtual vertical reference axis.
[0012] Further, the global objective function in step S4 includes the sum of squares of the differences between the radial distance from each sampling point to the theoretical center of its cross-section and the radius of that cross-section, and the sum of squares of the differences between the radii of adjacent cross-sections multiplied by a regularization coefficient. for:
[0013] in, M To measure the total number of cross sections, N i For the first i Number of sampling points per cross section For the first i The first section j The planar coordinates of each sampling point Let these be the plane coordinates of the theoretical center of the cross section. For the first i The radius of each cross section, l is the regularization coefficient.
[0014] Furthermore, the actual spatial axis described in step S4 adopts an inclination angle. α and azimuth β Parameterization: Let the axis direction vector The axis passes through the reference point. ,in Take the average height of all sections; then the first section... i The theoretical center coordinates of each cross section are:
[0015] The nonlinear least squares optimization algorithm employs the Levenberg-Marquardt algorithm, and the optimization variables include... and various ; It is the angle between the axis and the positive Z-axis. It is the angle between the projection of the axis onto the horizontal plane and the positive direction of the X-axis.
[0016] Furthermore, the calculation method for the vertical axis deviation in step S5 is as follows: Let the actual spatial axis parameters obtained from step S4 be: reference point coordinates. The axis tilt angle is azimuth angle is Then, at any height on the actual axis z The coordinates of the center of the circle at that location are:
[0017] The horizontal distance from this point to the virtual vertical reference axis is:
[0018] Vertical axis deviation is defined as the deviation within the measurement height range. Inside D ( z The maximum value of ), where and These are the height values of the lowest and highest measurement sections, respectively.
[0019] Furthermore, the tilt angle of the axis is , v For the actual spatial axis, The unit normal vector of the end face plane; the curvature is calculated based on the standard deviation of the vertical distance from the center of each cross-section circle to the actual spatial axis; the flatness of the end face is calculated based on the maximum absolute value of the directed distance from each point in the end face point cloud to the fitted plane of the end face; the concentricity is calculated based on the radius of the least square circle fitted by the horizontal projection point of the center of each cross-section circle.
[0020] Furthermore, the quality grading in step S5 includes: pre-setting vertical axis deviation threshold, axis tilt angle threshold, curvature threshold, and end face flatness threshold; when all calculated parameters are better than the corresponding thresholds, they are rated as Grade A; when all parameters meet the national standard limits but do not reach the Grade A threshold, they are rated as Grade B; when any parameter exceeds the national standard limit, they are rated as Grade C.
[0021] A system for detecting vertical axis deviation of pharmaceutical glass bottles based on the above method, the system comprising: The rotation positioning module is used to carry and fix the glass bottle of medicine to be tested, drive the glass bottle to rotate around its axis in increments, and provide rotation angle position information; The laser confocal scanning microscopy module is used to emit a laser beam toward the bottle mouth area, receive the reflected light signal, and obtain precise height information of each point on the bottle mouth surface through axial scanning; The multi-dimensional motion control module includes X-axis, Y-axis and Z-axis precision displacement platforms, which are used to position the objective lens of the laser confocal scanning microscope module to a predetermined measurement position above the bottle mouth and realize precise lifting and lowering movements during axial scanning. The point cloud acquisition module is connected to the rotation positioning module, the laser confocal scanning microscopy module, and the multi-dimensional motion control module. It is used to control the rotary table to rotate in increments and trigger the laser confocal scanning microscopy module to perform single-point axial scanning at each angular position. The surface height is located based on the peak light intensity obtained from the scan, and combined with the rotation angle and nominal radius, it is converted into three-dimensional Cartesian coordinates to obtain the circumferential three-dimensional point cloud of each measurement section and the annular grid point cloud of the upper end face of the bottle mouth. The end face reference extraction module is used to filter and denoise the end face point cloud, fit the end face plane using a random sampling consensus algorithm, and extract the unit normal vector of the end face plane as a virtual vertical reference axis. The global axis fitting module is used to uniformly substitute the circumferential point cloud data of all cross sections into the global objective function, and simultaneously solve the reference point coordinates, tilt angle, azimuth angle and radius of each cross section of the actual spatial axis through a nonlinear least squares optimization algorithm to obtain the actual spatial axis of the bottle opening. The multidimensional deviation calculation and grading module is used to calculate the vertical axis deviation, axis tilt angle, curvature, end face flatness and concentricity based on the actual spatial axis and the virtual vertical reference axis, and to grade the quality of the glass bottle under test according to the preset threshold and output the test report.
[0022] Compared with the prior art, the present invention has at least the following beneficial effects: First, this invention introduces LSCM (Laser-Sensitive Tomography) into the field of vertical axis deviation detection for pharmaceutical glass vials. Utilizing its nanometer-level longitudinal resolution and optical tomography capabilities, it completely overcomes the measurement accuracy bottlenecks of traditional contact dial gauges or single-point laser displacement sensors. By acquiring high-density three-dimensional point clouds and performing sub-micron-level height positioning, this invention can achieve vertical axis deviation detection at the micrometer or even sub-micrometer level, far exceeding the existing technology's accuracy of 0.01mm~0.1mm, meeting the stringent geometric accuracy requirements of high-end pharmaceutical glass packaging such as pre-filled syringes. Simultaneously, pinhole filtering based on the confocal principle effectively suppresses interference from ambient light, glass transmission, and surface reflection, significantly improving measurement repeatability and signal-to-noise ratio.
[0023] Secondly, this invention upgrades the traditional single-section two-dimensional radial runout measurement to multi-section three-dimensional spatial axis analysis. By adaptively planning multiple measurement sections and acquiring circumferential point clouds, the actual spatial axis of the bottle neck is fitted using global consistency optimization. Simultaneously, a virtual vertical reference axis is fitted using end-face point clouds, enabling the simultaneous calculation of multi-dimensional geometric parameters such as vertical axis deviation, axis tilt angle, curvature, end-face flatness, and concentricity. This improvement transforms the detection result from an isolated numerical value into a comprehensive assessment of the overall spatial morphology of the bottle neck, effectively distinguishing between different defect types such as overall bottle tilt and localized bending, providing rich information support for quality diagnosis and process improvement.
[0024] Furthermore, this invention creatively proposes a self-reference method based on the end face normal, which uses the point cloud fitting plane normal vector of the upper end face of the bottle neck as a virtual vertical reference axis, replacing the traditional method that relies on the mechanical axis of the rotary table. This self-reference scheme completely eliminates the influence of rotary table radial runout, installation eccentricity, and bottle bottom positioning errors on the measurement results. It not only reduces the equipment's dependence on the ultra-high precision rotary table but also effectively solves the problem of adaptability to the detection of irregularly shaped bottles or bottles with difficult bottom positioning, significantly improving the accuracy and reliability of the measurement results.
[0025] Furthermore, this invention employs a spatial axis fitting algorithm based on a globally consistent objective function (including data fitting terms and radius smoothing regularization terms), simultaneously optimizing all point cloud data from all cross-sections. This avoids the error propagation and accumulation inherent in the traditional two-step method (first independently fitting the center of a circle, then fitting a straight line). This algorithm is naturally robust to local anomalies such as mold lines and minor burrs, as the influence of a single anomaly is distributed throughout the global optimization process, thus ensuring the fitting accuracy and repeatability of the axis. Combined with an adaptive cross-section planning strategy (automatically densifying the measurement area based on changes in the bottle neck curvature), this invention effectively controls the amount of data collected and processing time while maintaining measurement accuracy, achieving a balance between efficiency and accuracy.
[0026] Finally, this invention integrates a highly automated inspection process, from pre-scanning, autofocus, point cloud acquisition to data processing, multi-dimensional parameter calculation, and quality grading, all without manual intervention. The system can automatically output an inspection report containing five dimensions of parameters and a comprehensive rating, and supports defect type diagnosis prompts, greatly improving the intelligence level and consistency of vertical axis deviation detection for pharmaceutical glass bottles, aligning with the pharmaceutical industry's trend towards digital and intelligent online quality control. Attached Figure Description
[0027] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0028] Figure 1 This is a schematic diagram of the components of the detection system provided in an embodiment of the present invention; Figure 2 This is a flowchart illustrating the detection method provided in an embodiment of the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, other embodiments obtained by those skilled in the art without creative effort are all within the scope of protection of the present invention.
[0030] I. Composition of the Detection System like Figure 1 As shown, the detection system used in this embodiment includes the following components: Laser confocal scanning microscope (LSCM): Utilizing a 405 nm semiconductor laser and equipped with a 40x / 0.75 NA confocal objective lens, it achieves a lateral resolution better than 0.3 μm and a longitudinal resolution better than 10 nm. The scanning galvanometer enables point-by-point scanning in the XY plane, while the Z-axis piezoelectric ceramic actuator enables nanometer-scale stepping axial scanning.
[0031] High-precision rotary table: This rotary table uses a direct-drive motor-driven air bearing bearing and has a built-in circular grating encoder. The indexing accuracy is ±0.05°, radial runout is less than 0.5 μm, and axial runout is less than 1 μm. A self-centering three-jaw chuck is located at the center of the rotary table for gripping the bottom of pharmaceutical glass bottles.
[0032] A three-axis precision displacement platform: X and Y axis travel 50 mm, repeatability ±1 μm; Z axis travel 30 mm, repeatability ±0.5 μm, used to position the LSCM objective lens to the bottle mouth measurement area.
[0033] Computer control system: Includes high-speed data acquisition card, motion control card and host computer software, used to control the coordinated work of rotary table, displacement platform and LSCM, and execute 3D point cloud data processing algorithms.
[0034] II. Testing Procedures and Parameter Settings like Figure 2 As shown, this embodiment mainly includes the following detection steps: Step 1: Pre-scanning and adaptive section planning The glass vial to be tested (using a 5 mL vial as an example in this embodiment) is placed upright on a self-centering three-jaw chuck at the center of the rotating stage. The operator tightens the chuck manually or pneumatically to ensure that the three jaws are evenly in contact with the bottom edge of the vial, ensuring that the initial alignment error between the center of the vial bottom and the rotation axis of the rotating stage is less than 0.5 mm. After starting the system, the computer controls the X and Y axis precision displacement platform to move the objective lens of the laser confocal scanning microscope (LSCM) to approximately 5 mm directly above the vial opening, as the starting position for pre-scanning.
[0035] The goal of pre-scanning is to quickly acquire the contour envelope R(z) of the bottle neck to the bottle mouth region, i.e., the radial distance from the outer surface of the bottle mouth to the central axis of the rotary table at different heights. To balance scanning speed and data quality, pre-scanning uses low resolution and large step size parameter settings. Specific operations: (1) Z-axis scanning range and step size: Starting from the bottle mouth end face (defined as z = 0mm), move downwards to the bottleneck area (in this embodiment, move downwards by 8mm, i.e., from z = 0 to z = 8mm). The Z-axis step size is set to Δz = 0.2mm, and a total of 8 / 0.2+1=41 height positions are executed.
[0036] (2) Lateral scan parameters: at each height position z k At this location, the LSCM performs a two-dimensional lateral scan. The scanning field of view is set to 2 mm × 2 mm, covering the edge area of the bottle neck. The number of lateral sampling points is 10 × 10 (i.e., 10 points in the X direction and 10 points in the Y direction), thus obtaining 100 light intensity data points at each height position. The scanning galvanometer drives the laser focus to traverse each point within the field of view along the grating path, and a confocal pinhole filters out stray light from the defocus plane. The photodetector records the light intensity value of each point.
[0037] (3) Edge detection and radial distance extraction: For each height position z k The acquired two-dimensional light intensity image is binarized (threshold set to 50% of the maximum light intensity), and then the Canny edge detection algorithm is used to extract the contour points of the outer edge of the bottle opening. Since the field of view includes the arc segment of the bottle opening edge, these edge points are fitted with a circle (least square method) to obtain the radius of the fitted circle on the outer surface of the bottle opening at that height. R fit ( z k Simultaneously, using the calibrated position of the rotary table center in the image coordinate system (pre-calibrated using a ring gauge), the offset of the fitted circle's center relative to the rotary table center is calculated. Only the radial distance is recorded in this step. R ( z k ) = R fit ( z k ) is used as the contour envelope value.
[0038] (4) Data output: A series of discrete points are obtained. z k , R ( z k )), k = 0,1,... form the contour envelope.
[0039] Because of noise in the pre-scan, therefore, firstly... R ( z Savitzky-Golay smoothing filtering was performed (window width 11 points, polynomial order 3). Then, in order to obtain curvature information at any z position, cubic spline interpolation was used to extend the discrete points into a continuous function with the domain z ∈ [0,8] mm.
[0040] The first derivative of the contour envelope reflects the rate of change of the bottle neck radius along the axial direction, and the second derivative... This reflects the severity of the rate of change, i.e., the rate of change of curvature. In the shape of the bottle neck, regions with drastic changes in curvature (such as the transition area between the bottle neck chamfer and the cylindrical surface, and the neck contraction area) are often locations of abrupt geometric changes. These regions have a significant impact on the spatial morphology of the axis, thus requiring more detailed measurement sections. Based on preliminary experiments with different bottle shapes, this embodiment sets the curvature threshold ε = 0.08. When the second derivative... When the absolute value exceeds 0.08, it means that the rate of change of radius per millimeter exceeds 0.08 mm, which is considered a significant change in curvature.
[0041] In the continuous interval [ z a , z b If If the interval length exceeds 0.5 mm, additional measurement sections are uniformly inserted within that interval, ensuring that the distance between adjacent sections does not exceed 0.5 mm. If If the default sparse sampling is maintained, the spacing between adjacent sections is controlled between 1.0 and 2.0 mm.
[0042] In this embodiment, the specific calculation process is as follows: After smoothing Calculating the second derivative yields the following key section: (1) z ∈ [0.1, 1.2] mm: the chamfered area of the bottle neck, The maximum value reached 0.35, exceeding the threshold. The length of this region is 1.1 mm. According to the encryption strategy, the cross-sectional spacing is set to 0.5 mm, resulting in height points: 0.1, 0.6, 1.1.
[0043] (2) z ∈ [1.2, 3.5] mm: the cylindrical segment at the bottle mouth, with a gentle change in curvature. By using sparse sampling and taking a cross-sectional spacing of 1.0 mm, we obtain the height points: 2.0 and 3.0 (the next one after 1.1 is 2.0, and the next one after that is 3.0).
[0044] (3) z ∈ [3.5, 5.5] mm: bottleneck transition region, The value increased again to 0.12, exceeding the threshold. The region length was 2.0 mm, and the encryption spacing was 0.5 mm, resulting in height points: 4.0, 4.5, 5.0, 5.5.
[0045] (4) z>5.5 mm: Bottleneck smoothing zone, The sparse sampling interval is 1.5 mm, but in order to control the total number of cross sections, it is only taken up to 6.0 mm.
[0046] The above height points are merged, sorted, and deduplicated. Points exceeding the actual measurement range of the bottle opening (0.1~6.0 mm) are removed, resulting in M=10 cross-sections at z = [0.1, 0.6, 1.1, 2.0, 3.0, 4.0, 4.5, 5.0, 5.5, 6.0] mm. It should be noted that the values listed in this embodiment are only examples; in actual operation, the algorithm will automatically adjust based on the measured values. The calculations are performed without human intervention.
[0047] The system will adaptively generate a list of measurement section heights {z1, z2, ..., z...} M The data is stored in memory and passed to the subsequent step 2 (multi-section 3D point cloud acquisition). Simultaneously, a unique identifier is assigned to each section, recording its corresponding curvature characteristics (such as chamfered areas, cylindrical areas, and bottleneck areas) for subsequent data analysis.
[0048] Step 2: Multi-section 3D point cloud acquisition After completing adaptive cross-section planning and obtaining a list of measurement cross-section heights, high-density circumferential 3D point cloud acquisition is performed on each cross-section, while a ring-shaped grid scan is performed separately on the upper surface of the bottle neck. The entire acquisition process is based entirely on the axial scanning principle of a laser confocal scanning microscope (LSCM), that is, by precisely moving the objective lens to change the focal plane position, recording the reflected light intensity at each depth, and using the light intensity peak to accurately locate the sample surface height. The following describes each step of the operation in detail using 10 measurement cross-sections in this embodiment as an example.
[0049] For the current section height that needs to be measured z i (e.g., the first section) z(1 = 0.1 mm). The system first controls the Z-axis displacement platform to move the LSCM objective to a height close to this point. Since the pre-scan has provided the approximate radial position of the cross-section, the working distance of the objective is now close to optimal, but precise focusing is still required to eliminate mechanical positioning errors and minor height fluctuations on the bottle neck surface. The autofocus process is as follows: the objective moves layer by layer within a range of 50 micrometers above and below its current position in steps of 0.5 micrometers. With each step, the LSCM acquires a small field-of-view lateral image (field of view 0.5 mm × 0.5 mm, resolution 50 × 50 pixels). For each image frame, its average light intensity or image contrast is calculated (usually using the Tenengrad gradient function). Since confocal microscopy reflects light most strongly only when the focal plane falls exactly on the sample surface, the change in light intensity or contrast with the Z position exhibits a sharp single-peak curve. The system performs a Gaussian fit on this series of light intensity values and the corresponding Z position, with the fitting function in the form:
[0050] in m This is the location of the optimal focal plane. The objective lens is then moved to this precise focusing position, and the system verifies successful focusing by checking whether the peak light intensity at the focus point exceeds a preset threshold. If the focus fails, the system expands the search range to ±100 micrometers and repeats the above process.
[0051] After focusing, the system begins a circular scan of the cross-section. The rotary stage uses a step-measurement mode, rather than continuous rotation, to avoid motion blur and synchronization errors. The rotary stage incorporates a circular grating encoder for precise angular position control. The system is set to an angular interval of 1°, therefore 360 points need to be measured for one 360° rotation, with the target angle at each point being [value missing]. i j = j ×1°( j = 1, 2, ..., 360). The control program sequentially instructs the rotary table to rotate to each... i j Upon arrival, the rotary table comes to a complete stop and remains stable for approximately 10 milliseconds to ensure sufficient vibration decay. The motion control card then sends a TTL trigger signal to the LSCM's data acquisition card, and the LSCM subsequently performs a single-point axial scan.
[0052] The purpose of single-point axial scanning is to obtain the precise height of the outer surface of the bottle neck at that angular position. During scanning, the Z-axis piezoelectric ceramic actuator operates at the current focus position. z focusCentered on the laser, the scanning range extends 10 micrometers upwards and downwards (total scanning range 20 micrometers), moving layer by layer in 20-nanometer steps. At each step position, the laser focus is fixed, and a photodetector (PMT) records the reflected light intensity at that point. Because the confocal pinhole filters out stray light from the non-focal plane, the light intensity variation with the Z position again exhibits a sharp single-peak curve. The system first performs median filtering (window width 5 points) on the acquired light intensity sequence to remove random noise, then uses the Levenberg-Marquardt algorithm to fit a Gaussian function, and the center position of the fitted peak is determined. m That is, the precise surface height of that point. h ij Thanks to the nanometer-level longitudinal resolution of LSCM and the sub-nanometer-level positioning accuracy of Gaussian fitting, the repeatability of height measurement in this embodiment is better than 10 nanometers.
[0053] After obtaining the height of the point, it needs to be converted into three-dimensional Cartesian coordinates for subsequent point cloud processing. Since the center of the rotary stage is defined as the origin of the measurement system, and the bottle opening rotates around this center during scanning, the natural coordinates of each sampling point are in polar coordinate form: angle. i j and radial distance r ij The radial distance is determined by the nominal radius of the cross-section. R nom The radius of the fitted circle at that height, derived from the pre-scan in step 1, is determined by both the measured height deviation and the actual height deviation.
[0054] in h ref This is the reference height for an ideally circular cross-section. In practice, since the height value output by LSCM is an absolute coordinate, and the nominal radius is also a length quantity, a more direct understanding is: the horizontal distance from that point. r ij This is the distance from the point to the center of the rotary table; therefore, the Cartesian coordinates can be calculated as follows:
[0055] The Z-coordinate is the cross-sectional height. z i Therefore, each sampling point obtains a three-dimensional coordinate. All 360 points constitute the circumferential point cloud of this cross-section. .
[0056] To ensure data quality, several verification and compensation mechanisms can be embedded during the scanning process. For example, if the peak light intensity at a certain angle is lower than a preset threshold (e.g., 30% of the maximum possible light intensity), it is determined that the signal at that point may be weak due to surface contamination, excessive tilting, or excessive transparency. The system will mark this point and remove it or compensate for it through interpolation in subsequent data processing. Another example is that the system checks whether the change in radial distance between adjacent angles exceeds 0.1 mm. If a sudden change occurs, it may be caused by burrs or noise. In this case, the system will automatically remeasure near that point (up to 3 times). Furthermore, after each 90° scan (i.e., every 90 points), the system will pause and quickly remeasure the height of the starting angle (0°) to monitor whether the stage or sample has drifted. If the drift exceeds 0.5 micrometers, an alarm will be issued and a restart of the measurement will be recommended.
[0057] After completing the circumferential scan of all 10 cross-sections, the system then acquires the point cloud data of the upper end face of the vial neck. The end face is a ring-shaped plane; in this embodiment, the ring width of the vial end face is approximately 1.5 mm (inner diameter 11 mm, outer diameter 13 mm). To obtain a complete three-dimensional topography of the end face, the system uses a mesh scanning method. The scanning area is defined radially from r = 5.5 mm to r = 7.0 mm, and angularly covering 0° to 360°. The radial step size is 0.05 mm, and the angular step size is 2°, resulting in a mesh point count of 31 radial nodes (because (7.0...). (5.5) / 0.05+1=31), 180 angle nodes (360° / 2°), totaling approximately 5580 sampling points. To reduce frequent start-stop cycles of the rotary table, the scanning path adopts an angle-first, radially increasing sequence: first, a radial position is fixed. r k The rotary table is moved from 0° to 360° in 2° increments to collect data from all points on the circumference, and then moved radially to the next point. r k+1 Then rotate another full circle, repeating this process until the entire annular area is covered. At each grid point... At that point, the system performs a single-point axial scan (Z-axis range ±10 micrometers, step size 20 nanometers, Gaussian fitting for height positioning) identical to the circular scan, obtaining the Z-coordinate of that point. Its X and Y coordinates are obtained by polar coordinate transformation: , The set of coordinates of all grid points constitutes the end face point cloud. .
[0058] Considering the potential slight tilt of the end face, a single initial focus position cannot guarantee that the entire end face is within the depth of focus range of the LSCM (typically less than 1 micrometer). Therefore, the system employs a dynamic refocusing strategy during end face scanning. Specifically, after each 10° angle scan (i.e., every 5 angle points), the system re-executes autofocus near the current scan position to track changes in end face height. For bottles with significant tilt (tilt angle exceeding 0.5°), predictive focusing can also be enabled: using the height information of already scanned points to fit a local plane, the system predicts the height of the next scan point and adjusts the Z-axis focus position in real time, thereby significantly improving the signal-to-noise ratio and scanning efficiency. After all 5580 points are acquired, the system saves the height value of each point in float32 format along with the X and Y coordinates as a binary point cloud file (e.g., .ply or .xyz), and simultaneously generates a metadata file recording information such as scan time, cross-sectional height list, angle interval, and axial scan parameters for subsequent steps (end face normal reference extraction and global axis fitting). At this point, the acquisition of 3D point clouds across multiple sections and end faces has been completed.
[0059] Step 3: Extraction of end face normal reference Complete the end face point cloud Q After data acquisition, the system needs to extract a stable and high-precision spatial reference for subsequent calculation of vertical axis deviation. Traditional methods rely on the mechanical axis of the rotary table itself as the reference, but the radial runout of the rotary table, installation eccentricity, and bottle bottom positioning error are directly coupled to the measurement results. Moreover, for irregularly shaped bottles with irregular bottoms, the mechanical reference is often unreliable. This embodiment utilizes the geometric characteristics of the upper end face of the bottle mouth (under ideal manufacturing conditions, the end face of the bottle mouth should be perpendicular to the theoretical axis of the bottle body) to define the end face fitting normal vector as a virtual vertical reference axis. In this way, the measurement reference no longer depends on the mechanical accuracy of the rotary table, but comes directly from the shape of the bottle mouth itself, realizing self-reference measurement. The following describes in detail the specific process of end face point cloud preprocessing, plane fitting, and reference extraction.
[0060] (1) Point cloud preprocessing: statistical filtering for noise reduction End face dot cloud Q The dataset contains approximately 5580 sampling points, among which a small number of outliers are inevitably mixed in. These outliers may be due to factors such as surface dust, abnormal local reflections on glass, or erroneous height values caused by detector noise. If these outliers are directly used in plane fitting, they will severely interfere with the accuracy of the fitting results; therefore, they must be removed first. This embodiment employs a statistical filtering (Statistical Outlier Removal) algorithm, which identifies outliers based on the distance distribution between each point and its neighboring points. The specific operation is as follows: For each point in the point cloud... The system uses a KD-tree data structure to quickly search for the K nearest neighbors of a given point. The average distance from this point to these K neighbors is then calculated. Since normal points are usually evenly distributed, their average distances tend to be concentrated within a small range; while outliers are often far from other points, and their average distances are significantly larger. The system calculates the overall mean of the average distances for all points. and standard deviation Then set a distance threshold. Any satisfaction Points that are outliers are identified as outliers and removed from the point cloud. In this embodiment, this step typically removes approximately 0.5% to 1% of the points, leaving a clean end-face point cloud. Q clean .
[0061] (2) RANSAC plane fitting Because the glass bottle neck may have minor local defects (such as chipped edges, bubbles, scratches) or chamfered edges during the manufacturing process, these areas are not ideal planar portions. If the traditional least squares method is used to directly fit the plane, these local outliers will skew the fitting result, causing the plane normal vector to deviate from the true direction. Therefore, this embodiment uses the Random Sample Consensus (RANSAC) algorithm for robust plane fitting. This algorithm can effectively eliminate outliers (i.e., points that do not belong to the planar structure) and calculate the optimal plane only based on interior points.
[0062] The basic idea of the RANSAC algorithm is random sampling, hypothesis testing, and iterative selection. The specific execution process is as follows: First, three key parameters are set: maximum number of iterations, distance threshold, and minimum proportion of valid inliers. In this embodiment, the maximum number of iterations is set to 1000, the distance threshold is set to 0.5 micrometers (i.e., 0.0005 millimeters), and the minimum number of valid inliers is set to 70% of the total number of points. After the algorithm starts, the system... Q clean Three non-collinear points are randomly selected from the point cloud to determine a candidate plane. Then, for all other points in the point cloud, the perpendicular distance from each point to the candidate plane is calculated. If the distance is less than a set distance threshold (0.5 micrometers), the point is classified as an interior point of the plane; otherwise, it is classified as an exterior point. The number of interior points of the candidate plane is counted. This random sampling process is repeated 1000 times, and each time the candidate plane with the most interior points and its set of interior points are recorded. After the iteration, the system selects the plane with the most interior points and performs a least-squares plane fitting using all the interior points corresponding to that plane (i.e., those points whose distance to the plane is less than 0.5 micrometers) to obtain the final plane equation.
[0063] (3) Extraction of plane equation and normal vector After RANSAC and subsequent least squares optimization, the system outputs the equation of the final fitted plane, expressed as:
[0064] in It is the unit normal vector. d This is the directed distance (in millimeters) from the origin to the plane. This equation describes the orientation and position of the end face in space. In this embodiment, the actually calculated normal vector is... n top = (0.0012, 0.0008, 0.9999). This value is very close to (0, 0, 1), which means that the end face is almost horizontal (i.e., the normal vector is almost vertically upward).
[0065] (4) Definition of virtual vertical reference axis Obtain the end face normal vector n top The system then defines it as a virtual vertical reference axis. "Virtual" here means that this reference does not originate from any physical mechanical axis (such as the central axis of a turntable), but is a mathematically calculated straight line derived entirely from the geometry of the bottle opening itself. The direction of this reference axis is... n top This represents the direction of the normal to the bottle neck face under ideal conditions. Since the bottle neck face should be perpendicular to the central axis of the bottle body during manufacturing and assembly, this normal direction represents the theoretical vertical direction of the bottle body. In subsequent steps, when calculating the vertical axis deviation, it is no longer necessary to rely on the mechanical axis of the turntable as a reference. Instead, the turntable is simply regarded as a rotation drive device, and its own runout error will not affect the final deviation result.
[0066] Step 4: Global Consistency Spatial Axis Fitting After completing the acquisition of multi-section circular point cloud data and extraction of end-face normal reference, the system obtained high-density point cloud data P1, P2, ..., P from 10 sections. 10Each cross-section contains 360 sampling points, recording the three-dimensional coordinates of the outer surface of the bottle opening at different heights. Traditional methods typically involve first independently fitting a center point for each cross-section, and then fitting these centers into a spatial straight line. However, this two-step method has significant drawbacks: when independently fitting the center point for each cross-section, only the point cloud information of that cross-section itself is utilized, ignoring the necessary geometric consistency between different cross-sections (i.e., all center points should approximately lie on the same straight line); furthermore, the error from independent fitting accumulates and propagates to subsequent straight line fitting, reducing the accuracy of the final axis. This embodiment proposes a globally consistent spatial axis fitting method that simultaneously incorporates all point cloud data from all cross-sections into a unified objective function, solving for the actual position, direction, and radius of the bottle opening's spatial axis in one go. This avoids error propagation and utilizes a radius smoothing regularization term to ensure a smooth change of the axis along the height direction, better reflecting the actual manufacturing characteristics of glass bottles.
[0067] (1) Parametric representation of spatial axes To facilitate optimization, the spatial axis to be solved first needs to be parameterized. A spatial line in three-dimensional space can be uniquely determined by a point and a direction vector. Let the coordinates of any point on the axis be p = (x, y, z), and the direction vector be... And satisfy Since the axis of the bottle neck is roughly perpendicular to the horizontal plane (i.e., close to the Z-axis direction), it can be used directly. and When used as a parameter, it is necessary to ensure that To avoid division by zero errors, a more robust parameterization method is to use a tilt angle. and azimuth Let represent the direction vector. Specifically, let:
[0068] in It is the angle between the axis and the positive direction of the Z-axis (i.e., the tilt angle, in radians or degrees). It is the angle between the projection of the axis onto the horizontal plane and the positive direction of the X-axis (i.e., the azimuth angle, measured in radians or degrees). When the axis is perfectly perpendicular... ,at this time This parameterization method naturally satisfies the unit length constraint and avoids the division by zero problem, making it very suitable for scenarios with small tilt angles.
[0069] For the selection of the reference point on the axis, the average height of all cross-sections is taken as the height of the reference point. In this embodiment, the heights of the 10 cross-sections are 0.1, 0.6, 1.1, 2.0, 3.0, 4.0, 4.5, 5.0, 5.5, and 6.0 mm, respectively, with an average value of [missing value]. mm. Horizontal coordinates of the reference point. It is the optimization variable to be solved, representing the axis at height. The horizontal position at that point. Therefore, for any height... Its corresponding theoretical center Located on the axis, its coordinates can be obtained by projecting a reference point along the axis. Because ,and (Approximate with a small angle), a more precise expression is:
[0070] This is because when the axis moves horizontally, the height changes by [per unit]. The horizontal displacement is The components of this displacement in the X and Y directions are respectively determined by... and Decision made. At this point, the entire axis is uniquely determined by four parameters: .
[0071] (2) Construction of the global objective function In addition to the axis parameters, each section also has its own radius. r i (i=1,2,…,10). These radii are allowed to vary slowly with height to reflect that the bottle neck is not a perfect cylinder (e.g., the radius is smaller at the chamfer of the neck, while the radius of the cylindrical section is larger). Let all the variables to be solved be denoted as... There are a total of 14 variables.
[0072] For the i The first section j sampling points Its theoretical center The radial distance is Ideally, this distance should be exactly equal to the radius of the cross section. Therefore, the radial error at this point can be defined as:
[0073] The sum of squared radial errors at all sampling points on all cross sections constitutes the first term of the objective function:
[0074] This ensures that the axis and radius parameters best fit all observed data.
[0075] However, if only using The optimization results may allow for drastic changes in the radius of adjacent sections (e.g., from 6.50 mm to 6.51 mm and then back to 6.50 mm). While this mathematically reduces the sum of squared errors, it does not conform to the actual manufacturing process of glass bottles. The radius of a real bottle opening changes continuously and slowly along the height direction, without any jagged abrupt changes. To constrain the smoothness of the radius, this embodiment introduces a radius smoothing regularization term:
[0076] in l It is a positive regularization coefficient used to balance the weights between data fit and smoothness. l The larger the radius, the heavier the penalty for the difference in radius between adjacent sections, and the smoother the resulting radius curve; l The smaller the value, the more emphasis is placed on accurately fitting each sampling point. In this embodiment, the value is determined through preliminary experiments. l A value of 0.05 achieves the desired effect, ensuring a smooth change in radius along the height without deviating excessively from the measured data. The dimensions of this value are consistent with the square of the length, and its selection can be adjusted based on point cloud density and bottle mouth roughness, typically ranging from 0.001 to 0.1.
[0077] The final global objective function is: .
[0078] (3) Nonlinear optimization solution The objective function is nonlinear with respect to the variables (due to the presence of square roots and trigonometric functions), thus requiring a nonlinear least squares optimization algorithm. This implementation uses the Levenberg-Marquardt (LM) algorithm, which combines the fast convergence of the Gauss-Newton method with the robustness of gradient descent, making it well-suited for small to medium-sized parameter estimation problems. Before starting the iteration, all variables need to be assigned reasonable initial values. The choice of initial values directly affects the convergence speed and whether the problem gets trapped in local optima. In this embodiment, the initial values are set as follows: Assume the axis passes through the center of the turntable at the reference height (i.e., assume the bottle is approximately centered). Assume the axis is initially vertical (without tilt); The initial radius of each section is taken as the nominal radius at the corresponding height obtained in step 1 pre-scan (i.e., the contour envelope R(z)). i (The values of these nominal radii may contain errors due to the low resolution of the pre-scan, but they are sufficient as initial values).
[0079] Each iteration of the LM algorithm requires calculating the partial derivatives of the objective function with respect to each variable (i.e., the Jacobian matrix). Since the number of variables is relatively small (14) and the total number of sampling points is large (10 × 360 = 3600), the gradient can be approximated using numerical differencing, or the expressions for each partial derivative can be analytically derived. This embodiment uses analytical derivatives to improve computational efficiency. The iteration process continuously updates the variable values until the convergence condition is met: the absolute value of the change in all parameters is less than 10. 6 mm or less than 10 6 The time taken is either radians or more than 200 iterations. In this embodiment, the algorithm converges after about 35 iterations, taking about 0.5 seconds (on a typical workstation).
[0080] (4) Optimization results and axis determination The optimal parameters obtained after convergence are: mm, mm: indicates the height At a position of mm, the horizontal position of the axis is approximately offset from the center of the rotary table. mm; , This indicates that the axis is tilted by 0.23° relative to the vertical direction, and the tilt direction points to an azimuth angle of 35.2° (that is, the direction of rotating 35.2° counterclockwise from the positive direction of the X-axis). Radius of each section The radius gradually increases from approximately 6.45 mm at z=0.1 mm to approximately 6.52 mm at z=6.0 mm, which is consistent with the manufacturing characteristics of a slightly smaller radius in the chamfered area of the bottle mouth and a slightly larger radius in the cylindrical section. Furthermore, the radius of adjacent sections does not change by more than 0.02 mm, resulting in good smoothness.
[0081] Based on these parameters, the actual spatial axis of the bottle neck can be written out completely. L actual The equation is given. The axis passes through the point... mm, direction vector is:
[0082] The direction vector is almost vertical (the Z component is close to 1), and the horizontal component is very small, which is consistent with expectations.
[0083] Thus, the system successfully extracted the precise position and orientation of the actual spatial axis of the bottle opening from 3600 point cloud data points across 10 cross-sections through global consistency optimization. Compared with the traditional two-step method of first determining the center and then the line, this method has the following significant advantages: First, all point cloud data participate in the constraint simultaneously, avoiding error propagation and accumulation; second, the radius smoothing regularization term ensures the smoothness of the axis along the height direction, conforming to physical reality; third, it has natural robustness to local anomalies such as parting lines and burrs, because the influence of a single anomaly on the global objective function is distributed across all points.
[0084] Step 5: Multi-dimensional deviation calculation and quality grading (1) Calculation of vertical axis deviation Vertical axis deviation is a core indicator for measuring the degree of deviation between the bottle neck centerline and the theoretical vertical axis. In this embodiment, the theoretical vertical axis is the end face normal vector obtained in step 3. n top Defined, this normal vector represents the ideal vertical direction of the bottle neck end face. Because the end face normal vector... n top In this embodiment, the virtual vertical reference axis is very close to (0,0,1) (i.e., almost vertically upward). To simplify calculations, it can be approximated as a straight line passing through the center of the rotary table (origin) and oriented along the Z-axis. More precisely, the vertical axis deviation is defined as the maximum horizontal distance from any point on the actual axis to the virtual vertical reference axis. Since the virtual reference axis is vertical, this horizontal distance is the distance of the horizontal projection of that point on the actual axis to the origin.
[0085] Any height on the actual axis z The coordinates of the center of the circle at that location are given by the axis parameters from step 4:
[0086] in This is a reference height (2.55 mm in this embodiment). This reflects the horizontal displacement caused by each unit height change along the axis. The horizontal distance of this point from the virtual vertical reference axis (Z-axis) is:
[0087] This is a function of height z. Because As a positive constant, D(z) either changes monotonically within the measurement range or decreases first and then increases, with its maximum value necessarily appearing at the endpoints of the interval (i.e., the lowest or highest cross-section). In this embodiment, the height range covered by the measurement cross-section is z∈[0.1,6.0]mm. Calculate D(z) at both endpoints: at z=0.1mm, D(0.1)≈0.014mm; at z=6.0mm, D(6.0)≈0.038mm. Therefore, the maximum value E... axial = 0.038mm, meaning the vertical axis deviation of the vial is 0.038 mm.
[0088] (2) Calculation of the inclination angle of the axis Axis tilt angle i tilt This directly reflects the angle between the actual axis of the bottle opening and the normal direction of the end face (i.e., the theoretical vertical direction). This is a purely angular quantity and is independent of translation. Based on the actual axis direction vector in step 4... v and the end face normal vector in step 3 n top The angle between the two is given by the dot product formula:
[0089] In this embodiment, n top ≈ (0,0,1), therefore Substituting into i tilt =0.23°. Note that this value is exactly equal to the tilt angle obtained in step 4, because the end face normal is approximately perpendicular, and the two are consistent. If the end face itself has a large tilt, then n top No longer approaching (0,0,1), the tilt angle needs to be rigorously calculated using the dot product. This parameter is crucial for evaluating the bottle neck's sealing performance: an excessively large tilt angle can lead to uneven force on the rubber stopper during capping, potentially causing leakage.
[0090] (3) Calculation of curvature The curvature B is used to quantify whether the actual axis is curved, that is, the degree to which the center of each cross-section deviates from the fitted spatial straight line. Even if an axis is tilted as a whole (i.e., α (A larger curvature) As long as all the centers of the circles lie strictly on a straight line, the curvature is zero; conversely, if the axis resembles a twisted curve, even if the overall tilt is small, the curvature will be large. The curvature calculation is based on the actual axis obtained in step 4. L actual and the center of each cross section c i (i=1,…,10). First, for the center of each cross-section... c i(, calculate its in L actual The foot on the top .because L actual It is a straight line, and the foot of the perpendicular can be obtained through parametric projection: parameters ,but Then calculate. c i Distance to the foot of the perpendicular .all d i The standard deviation is the curvature:
[0091] In this embodiment, each d i All values are less than 0.005 mm, resulting in B = 0.0032 mm. This extremely small value indicates that the actual axis is almost a perfectly straight line, and there is no local bending or twisting deformation at the bottle opening.
[0092] (4) Calculation of end face flatness end face flatness F Directly derived from the end face point cloud in step 3 Q to the fitting plane The degree of deviation. Flatness is defined as the maximum of the absolute values of the directed distances from all points to the plane. For any point in the end face point cloud... ,calculate:
[0093] Then take all Maximum value:
[0094] In this embodiment, F = 0.008 mm was obtained. This means that the height difference between the highest and lowest points on the entire annular end face does not exceed 8 micrometers, and the end face is very flat. The flatness of the end face is directly related to the sealing effect with the rubber stopper or aluminum cap, and is one of the key parameters for quality control of pharmaceutical glass bottles.
[0095] (5) Calculation of concentricity Concentricity C is used to evaluate whether the horizontal projections of the centers of circles at different heights converge at a single point. Even if the axis is a straight line and the tilt angle is constant, the horizontal projections of the centers of each circle will shift in a certain direction due to the tilt, but their trajectory should be a straight line segment, not a scattered circle. Concentricity is actually the radius of the least-squares circle fitted by these projection points. In specific calculations, the centers of each circle... c i The X and Y coordinates are extracted to obtain a two-dimensional point set. To fit a circle using the least squares method: Let the center of the circle be (Xc, Yc) and the radius be Rc, such that...
[0096] Minimize. This optimization problem can be solved numerically (e.g., Levenberg-Marquardt or direct analytical formulas). The fitted radius Rc is the concentricity C. In this embodiment, Xc ≈ 0.010 mm, Yc ≈ 0.006mm, C=0.014mm. The smaller the concentricity, the more the centers of the circles at different heights are concentrated on the same vertical line, and the better the overall coaxiality of the bottle opening.
[0097] (6) Quality grading and report output After obtaining the above five quantitative indicators, the system automatically grades the data according to preset quality thresholds. These thresholds can be tightened based on national standards (such as YBB00192003-2015) or enterprise internal control standards. The thresholds used in this embodiment are: vertical axis deviation Taxial = 0.10 mm, axis tilt angle Ttilt = 0.5°, curvature Tbend = 0.05 mm, and end face flatness Tflat = 0.03 mm. The grading rules are as follows: if all indicators are better than the above thresholds, the system is rated as Grade A (Excellent); if all indicators meet the YBB standard but do not reach the Grade A threshold, the system is rated as Grade B (Good); if any indicator exceeds the YBB standard, the system is rated as Grade C (Unqualified).
[0098] The system automatically generates a test report, which includes: sample information (such as batch number and bottle type), measurement date, parameter values for each dimension and corresponding pass / fail criteria, and overall rating. The report can be exported as PDF or Excel format, and the original point cloud data, fitted axis diagram, and deviation curve are also saved for easy quality traceability. If any non-conformities are found, the system will also output defect type suggestions, such as main problems like axis tilting or out-of-tolerance end-face flatness, helping operators quickly locate process issues.
[0099] By using the above five dimensions and quality grading, this invention not only provides a precise value for the vertical axis deviation, but also conducts a three-dimensional assessment of the bottle mouth quality from the perspective of spatial geometric integrity. This overcomes the limitations of traditional methods that only output a single value, and provides a richer and more reliable decision-making basis for the quality control of high-end pharmaceutical glass bottles.
[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; under the concept of the present invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the present invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for detecting vertical axis deviation of a pharmaceutical glass bottle based on LSCM, characterized in that, Including the following steps: Step S1: Pre-scanning and adaptive section planning The glass vial to be tested was fixed on a rotating stage, and a laser confocal scanning microscope was used to pre-scan along the axial direction of the vial opening to obtain the contour envelope of the region from the vial opening to the neck. R ( z ),in z The axial distance from the bottle neck end face; the height positions of multiple measurement sections are adaptively determined according to the rate of curvature change of the contour envelope, so that the measurement sections are more densely packed in the region of large curvature change; Step S2: Acquisition of 3D point clouds of multiple sections and end faces At each measured section height, the rotary table is controlled to rotate in increments, and a single-point axial scan is performed at each angular position using a laser confocal scanning microscope. The surface height of the point is obtained by positioning the peak light intensity. Combined with the rotary table angle and the nominal radius of the section, the coordinates are converted to Cartesian coordinates to obtain the circumferential three-dimensional point cloud of each section. At the same time, a ring grid scan is performed on the upper end face of the bottle mouth to obtain the three-dimensional point cloud of the end face. Step S3: Extraction of end face normal reference The three-dimensional point cloud of the end face is filtered and denoised, and the end face plane is fitted using a random sampling consensus algorithm to obtain the unit normal vector of the end face plane. This normal vector is defined as the virtual vertical reference axis. Step S4: Global Consistency Spatial Axis Fitting The circular point cloud data of all the obtained cross sections are uniformly substituted into the global objective function, and the reference point coordinates, tilt angle, azimuth angle and radius of each cross section are solved simultaneously by the nonlinear least squares optimization algorithm to obtain the actual spatial axis of the bottle mouth. Step S5: Multi-dimensional deviation calculation and quality grading Based on the actual spatial axis and the virtual vertical reference axis, the vertical axis deviation, axis tilt angle, curvature, end face flatness and concentricity are calculated, and the quality of the glass bottle under test is graded according to the preset threshold.
2. The method for detecting vertical axis deviation of pharmaceutical glass bottles as described in claim 1, characterized in that, The adaptive determination of the height positions of multiple measurement sections in step S1 specifically includes: For the contour envelope R ( z Perform smoothing filtering and cubic spline interpolation, and calculate its second derivative. Set curvature threshold ε ,when And when the length of a continuous interval exceeds the preset minimum encryption length, the measurement cross-section within that interval is encrypted so that the distance between adjacent cross-sections does not exceed the first spacing threshold; when When the cross-section is set according to the sparse sampling method, the spacing between adjacent cross-sections is the second spacing threshold, and the second spacing threshold is greater than the first spacing threshold.
3. The method of detecting vertical axis deviation of a pharmaceutical glass bottle according to claim 1, wherein The single-point axial scan in step S2 includes: Centered on the current focusing position, the objective lens of the laser confocal scanning microscope is moved in nanometer-scale steps within a preset axial scanning range, and the reflected light intensity at each step position is recorded to form a light intensity sequence. After median filtering of the light intensity sequence, Gaussian fitting is used to locate the peak position of the light intensity, which is the surface height of the current point.
4. The method of detecting vertical axis deviation of a pharmaceutical glass bottle according to claim 1, wherein The extraction of the end face normal reference in step S3 specifically includes: Step S3-1: Statistical Filtering for Noise Reduction For end face point cloud For each point Search for its nearest preset number of neighboring points and calculate the average distance from that point to all its neighboring points. ; Calculate all mean and standard deviation Set the distance threshold to Points with an average distance greater than the threshold are removed to obtain the point cloud of the clean end face. Q clean ; Step S3-2: RANSAC plane fitting from Q clean Three non-collinear points are randomly selected from the data to determine the candidate plane equation. ,in For unit normal vector, d Let be the distance from the origin to the plane; calculate the distance from all other points to the plane. ,like If the distance is less than the preset distance threshold, the point is classified as an interior point; repeat the random sampling and interior point statistics process until the preset maximum number of iterations, record the candidate plane with the most interior points and its interior point set, and require that the number of interior points is not less than the preset minimum proportion of the total number of points; Step S3-3: Least Squares Refinement Plane Using the obtained set of interior points, the final plane is fitted using the least squares method, i.e., the following optimization problem is solved: in L The total number of interior points; the optimal unit normal vector is obtained. and optimal plane constant and will n top Defined as a virtual vertical reference axis.
5. The method of detecting vertical axis deviation of a pharmaceutical glass bottle according to claim 1, wherein The global objective function in step S4 includes the sum of the squares of the differences between the radial distance from each sampling point to the theoretical center of its cross-section and the radius of that cross-section, and the sum of the squares of the differences between the radii of adjacent cross-sections multiplied by a regularization coefficient. for: in, M To measure the total number of cross sections, N i For the first i Number of sampling points per cross section For the first i The first section j The planar coordinates of each sampling point Let these be the plane coordinates of the theoretical center of the cross section. For the first i The radius of each cross section, λ This is the regularization coefficient.
6. The method of detecting vertical axis deviation of a pharmaceutical glass bottle according to claim 5, wherein The actual spatial axis in step S4 takes an inclination angle α and an azimuth angle β Parameterization: Let the axis direction vector pass through the reference point where Take the mean of all cross-sectional heights; then the theoretical center of the i first cross-section is given by: The non-linear least squares optimization algorithm adopts Levenberg-Marquardt algorithm, and the optimization variables include and each ; is the angle between the axis and the positive direction of the Z axis, is the angle between the projection of the axis in the horizontal plane and the positive direction of the X axis.
7. The method of detecting vertical axis deviation of a pharmaceutical glass bottle according to claim 6, wherein The calculation method for the vertical axis deviation mentioned in step S5 is as follows: Let the actual spatial axis parameters obtained from step S4 be: reference point coordinates. The axis tilt angle is azimuth angle is Then, at any height on the actual axis z The coordinates of the center of the circle at that location are: The horizontal distance from this point to the virtual vertical reference axis is: Vertical axis deviation is defined as the deviation within the measurement height range. Inside D ( z The maximum value of ), where and These are the height values of the lowest and highest measurement sections, respectively.
8. The method of detecting vertical axis deviation of a pharmaceutical glass bottle according to claim 6, wherein The tilt angle of the axis is , v For the actual spatial axis, The unit normal vector of the end face plane; the curvature is calculated based on the standard deviation of the vertical distance from the center of each cross-section circle to the actual spatial axis; the flatness of the end face is calculated based on the maximum absolute value of the directed distance from each point in the end face point cloud to the fitted plane of the end face; the concentricity is calculated based on the radius of the least square circle fitted by the horizontal projection point of the center of each cross-section circle.
9. The method of detecting vertical axis deviation of a pharmaceutical glass bottle of claim 1, wherein, The quality grading in step S5 includes: pre-setting vertical axis deviation threshold, axis tilt angle threshold, curvature threshold, and end face flatness threshold; when all calculated parameters are better than the corresponding thresholds, they are rated as Grade A; when all parameters meet the national standard limits but do not reach the Grade A threshold, they are rated as Grade B; when any parameter exceeds the national standard limit, they are rated as Grade C.
10. A system for detecting vertical axis deviation of a pharmaceutical glass bottle based on the method of any one of claims 1 to 9, characterized in that, include: The rotation positioning module is used to carry and fix the glass bottle of medicine to be tested, drive the glass bottle to rotate around its axis in increments, and provide rotation angle position information; The laser confocal scanning microscopy module is used to emit a laser beam toward the bottle mouth area, receive the reflected light signal, and obtain precise height information of each point on the bottle mouth surface through axial scanning; The multi-dimensional motion control module includes X-axis, Y-axis and Z-axis precision displacement platforms, which are used to position the objective lens of the laser confocal scanning microscope module to a predetermined measurement position above the bottle mouth and realize precise lifting and lowering movements during axial scanning. The point cloud acquisition module is connected to the rotation positioning module, the laser confocal scanning microscopy module, and the multi-dimensional motion control module. It is used to control the rotary table to rotate in increments and trigger the laser confocal scanning microscopy module to perform single-point axial scanning at each angular position. The surface height is located based on the peak light intensity obtained from the scan, and combined with the rotation angle and nominal radius, it is converted into three-dimensional Cartesian coordinates to obtain the circumferential three-dimensional point cloud of each measurement section and the annular grid point cloud of the upper end face of the bottle mouth. The end face reference extraction module is used to filter and denoise the end face point cloud, fit the end face plane using a random sampling consensus algorithm, and extract the unit normal vector of the end face plane as a virtual vertical reference axis. The global axis fitting module is used to uniformly substitute the circumferential point cloud data of all cross sections into the global objective function, and simultaneously solve the reference point coordinates, tilt angle, azimuth angle and radius of each cross section of the actual spatial axis through a nonlinear least squares optimization algorithm to obtain the actual spatial axis of the bottle opening. The multidimensional deviation calculation and grading module is used to calculate the vertical axis deviation, axis tilt angle, curvature, end face flatness and concentricity based on the actual spatial axis and the virtual vertical reference axis, and to grade the quality of the glass bottle under test according to the preset threshold and output the test report.