A cigarette length rapid measurement method, system and application
Patent Information
- Application Number
- CN202611138962.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-29
- Publication Date
- 2026-09-18
AI Technical Summary
但是,该方案无法直接转用于烟支长度测量,该方案点云获取对象是烟支端面,采集的点云仅包含烟支一个端面的局部区域;而烟支长度测量需要烟支整体(两端之间全长)的三维点云;且该方案采用RANSAC平面分割提取基准面,而长度测量需拟合烟支整体圆柱体模型,平面分割无法捕捉细长圆柱体的轴向延伸特征
[0035] This invention introduces a consistency metric between the principal axis direction and local normal direction based on principal component analysis, and constructs a weighted random sampling mechanism based on direction consistency to guide the generation of the cylindrical model assumption. This prevents the RANSAC segmentation process from blindly sampling uniformly, instead biasing towards the true cylindrical structure of the cigarette stick. This significantly improves the convergence efficiency and segmentation stability in point cloud scenarios with a stage background, tobacco interference, and noise. It enables accurate extraction of the main structure of multiple cigarette sticks and effective suppression of non-cylindrical appendages. At the same time, it abandons the traditional two-dimensional image endpoint or farthest point distance measurement method. Based on the optimal cylinder axis, it performs axial projection on the inner point set and calculates the length using the extreme difference of the projected coordinates. This transforms three-dimensional length measurement into one-dimensional scalar interval estimation under model constraints, significantly reducing measurement errors caused by end face defects, placement tilt, and surface irregularities. It balances non-contact, fast processing, and high measurement accuracy, meeting the real-time and robust requirements of industrial online inspection.
Smart Images

Figure CN122774983A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of tobacco product quality testing technology, and in particular to a method, system and application for rapid measurement of cigarette length. Background Technology
[0002] In cigarette manufacturing, precise control of cigarette length is a key parameter for ensuring consistent product quality. According to industry standards, the measurement benchmark for cigarette length is strictly defined as the axial distance between the filter tip and the cut surface of the cigarette paper. However, in high-speed automated production environments, due to dynamic errors in the slitting mechanism and mechanical vibrations in the conveying system, cigarette ends often exhibit protruding tobacco or uneven cuts, causing the actual dimensions to exceed the standard definition. This structural deviation makes it difficult for traditional measurement methods to accurately capture the true effective length, thus placing higher demands on the quality control system. To meet the quality control needs of modern production, the industry currently mainly adopts non-contact automated measurement solutions, including projection methods based on optical principles, image processing methods based on machine vision, and detection methods based on X-ray transmission. These technologies achieve digital measurement of cigarette dimensions through different sensing mechanisms. Among them, the machine vision method uses a high-resolution camera to acquire cigarette images and employs edge detection algorithms to identify the positional relationship between the filter tip and the cut surface of the cigarette paper.
[0003] Cigarette length is a core quality control indicator in tobacco product manufacturing. Its measurement accuracy directly determines the compliance of finished cigarettes, batch quality consistency, and end-user smoking experience. Currently, mainstream cigarette length measurement technologies still reveal several key shortcomings in practical industrial applications, primarily focusing on measurement accuracy, operational efficiency, and scenario adaptability. Traditional photoelectric measurement devices cannot effectively distinguish between exposed tobacco at the cigarette tip and the standard-defined effective length boundary, leading to inherent systematic deviations between measurement results and true values. Furthermore, these devices often require manual pre-processing of the cigarette tip to eliminate interference from exposed tobacco, significantly increasing the risk of damage. The increased complexity and time cost of the existing technology, coupled with the significant risk of human error, make it difficult to meet the demands of large-scale, high-efficiency industrial testing. While 2D image processing measurement methods can distinguish different functional sections of cigarettes through intelligent recognition technology, the measurement accuracy is easily affected by camera lens optical distortion and ambient lighting conditions. In particular, under conditions where the texture of the cigarette tipping paper and cigarette paper on the cigarette surface is complex, the positioning accuracy of the cigarette end edge is difficult to guarantee stably, making it unsuitable for complex and ever-changing production environments. These inherent shortcomings of the existing technology have become the core bottleneck restricting the tobacco industry from achieving high-precision, high-efficiency, and highly adaptable online full inspection of cigarette length.
[0004] The root cause of the aforementioned technical difficulties lies in the mismatch between the measurement principle and the physical characteristics of cigarettes, as well as the inherent technical bottlenecks in the system integration process. From a material properties perspective, cigarettes, as flexible composite materials, are prone to deformation during clamping, conveying, and measurement. This deformation directly alters their external contour characteristics, leading to data distortion from the sensors. From a sensing technology perspective, optical measurement methods are limited by the diffuse reflection characteristics of the cigarette surface, while X-ray measurement faces issues of signal attenuation and noise interference. Image acquisition methods can eliminate the influence of exposed tobacco, but lens distortion and perspective errors during the acquisition process are difficult to completely eliminate using conventional algorithms, becoming a major obstacle to improving measurement accuracy. Regarding system integration, signal cross-interference generated when multiple sensors work together, as well as backlash errors in mechanical transmission components, collectively constrain the overall performance of the measurement system.
[0005] For example, patent application CN121453791A discloses an automatic detection method, system, and storage medium for physical defects on the end face of a cigarette. The method includes: acquiring three-dimensional point cloud data of the end face of the cigarette to be tested; obtaining a reference plane for the end face based on the three-dimensional point cloud data; calculating the geometric parameters of the end face based on the reference plane; and obtaining the detection result of physical defects on the end face based on the geometric parameters. This invention acquires complete three-dimensional point cloud data in a single scan, accurately extracts the end face reference plane using the RANSAC algorithm, and performs a comprehensive evaluation based on multiple indicators, achieving broad coverage and comprehensive quantitative evaluation of various defects such as loose ends, contact points, and coil ejection. However, this scheme cannot be directly applied to cigarette length measurement. The point cloud acquired in this scheme only captures a local area of one end face of the cigarette, while cigarette length measurement requires a 3D point cloud of the entire cigarette (the full length between the two ends). Furthermore, this scheme uses RANSAC planar segmentation to extract the reference plane, while length measurement requires fitting a complete cylindrical model of the cigarette; planar segmentation cannot capture the axial extension features of a slender cylinder. In addition, the RANSAC sampling strategy in this scheme does not incorporate the cigarette as a directional prior for the slender cylinder, making it susceptible to interference from tobacco shreds and background noise in the full-length point cloud, hindering stable convergence to the complete cylindrical model of the cigarette. Therefore, it cannot meet the requirement of global geometric consistency for length measurement.
[0006] Therefore, a more targeted and rapid method for measuring cigarette length is needed to solve the aforementioned technical problems. Summary of the Invention
[0007] In view of the shortcomings of the prior art, the present invention provides a method, system and application for rapid measurement of cigarette length, which can perform rapid, systematic and repeatable non-contact precision measurement of cigarette length.
[0008] To achieve the above and related objectives, the present invention adopts the following technical solution:
[0009] The first aspect of this invention provides a method for rapid measurement of cigarette length, comprising the following steps:
[0010] Step S100: Obtain the three-dimensional point cloud data of the cigarette to be detected and perform preprocessing to obtain an optimized point cloud dataset;
[0011] Step S200: Based on the optimized point cloud dataset, the principal axis direction of the point cloud as a whole is determined by principal component analysis; the consistency metric between the local normal and the principal axis direction of each point in the optimized point cloud dataset is calculated, and the corresponding sampling weight is assigned to the point according to the consistency metric, wherein the point with higher consistency is assigned a larger sampling weight.
[0012] Step S300: The random sampling process is guided by sampling weights. A weighted random sampling mechanism based on directional consistency is used to iteratively generate cylinder model hypotheses. The optimal cylinder model and its corresponding set of interior points are obtained by filtering according to the number of interior points corresponding to each hypothesis. The cylinder structure representing the main body of the cigarette is extracted by segmentation. The model parameters of the optimal cylinder model include at least the axis direction vector.
[0013] Step S400: Based on the axis of the optimal cylindrical model, project the corresponding set of interior points onto the axis direction, and calculate and output the cigarette length based on the extreme difference of the projected coordinates.
[0014] Further, in step S100, the preprocessing includes:
[0015] Adaptive filtering is performed on 3D point cloud data based on local surface curvature features to distinguish between foreground and background. The distinguished foreground point cloud is then smoothed using moving least squares filtering, and the smoothed point cloud is downsampled to obtain an optimized point cloud dataset.
[0016] Furthermore, in step S200, the formula for calculating the consistency metric value satisfies the following formula 1:
[0017] (Formula 1),
[0018] In formula 1, This represents the consistency metric value of the i-th point; n i v represents the local normal at the i-th point; g This indicates the overall principal axis direction of the point cloud as determined by principal component analysis; A sharpening factor greater than 1; To ensure robustness, use minimal normal numbers.
[0019] Further, in step S200, assigning the corresponding sampling weight to the point based on the consistency metric includes:
[0020] A monotonically increasing mapping relationship is established between the consistency metric and the sampling weights, so that the closer the local normal is to the principal axis direction, the higher the probability that a point will be selected as a model hypothesis sample. Based on this mapping relationship, each point in the optimized point cloud dataset is assigned a corresponding sampling weight to form a non-uniform weighted sampling distribution.
[0021] Furthermore, in step S300, the assumptions for iteratively generating the cylindrical model using a weighted random sampling mechanism based on directional consistency include:
[0022] In each iteration, the minimum sample point set for generating the cylindrical hypothetical model is selected from the optimized point cloud dataset according to the weighted sampling distribution; the parameter hypothesis of the cylindrical model is obtained by fitting based on the minimum sample point set; the conformity of each point in the optimized point cloud dataset with the parameter hypothesis is calculated, and each point is divided into in-model points or out-of-model points according to the preset criteria, and the number of in-model points is counted as the evaluation index of this iteration; after multiple iterations, the parameter hypothesis with the most in-model points is determined as the optimal cylindrical model, and its corresponding in-model point set is used as the main point cloud of the cigarette.
[0023] Furthermore, in step S300, while segmenting and extracting the cylindrical structure that represents the main body of the cigarette, interference points that do not conform to the geometric consistency of the optimal cylindrical model are also eliminated from the inner points. Interference points include tobacco shreds, debris, and outlier noise points.
[0024] Furthermore, in step S400, the formula for calculating the length of the cigarette satisfies the following formula 2:
[0025] (Formula 2),
[0026] In Formula 2, L k t is the length of the k-th cigarette; i Let be the scalar coordinates obtained by projecting the i-th interior point in the interior point set corresponding to the k-th cigarette along the axis of the optimal cylindrical model of that cigarette; the optimal cylindrical model is denoted as . , where a k As a reference point on the axis, u k r is the direction vector of the axis. k The radius of the cylinder is max(t). i ) and min(t i ) are the maximum and minimum values of all scalar projected coordinates of the interior point set, respectively.
[0027] A second aspect of the present invention provides a rapid cigarette length measurement system, comprising:
[0028] The acquisition and preprocessing module is used to acquire the three-dimensional point cloud data of the cigarette to be detected and perform preprocessing to obtain an optimized point cloud dataset;
[0029] The consistency quantization module is used to determine the overall principal axis direction of the point cloud based on the optimized point cloud dataset through principal component analysis; calculate the consistency metric between the local normal and the principal axis direction of each point in the optimized point cloud dataset; and assign corresponding sampling weights to the points based on the consistency metric, with points with higher consistency being assigned larger sampling weights.
[0030] The segmentation and extraction module is used to guide the random sampling process with sampling weights. It iteratively generates cylindrical model hypotheses using a weighted random sampling mechanism based on directional consistency. The optimal cylindrical model and its corresponding set of interior points are selected based on the number of interior points corresponding to each hypothesis. The cylindrical structure representing the main body of the cigarette is extracted by segmentation. The model parameters of the optimal cylindrical model include at least the axis direction vector.
[0031] The calculation module is used to project the corresponding set of interior points onto the axis direction based on the axis of the optimal cylindrical model, and calculate and output the length of the cigarette based on the extreme difference of the projected coordinates.
[0032] A third aspect of the present invention provides a computer-readable storage medium having computer-readable instructions stored thereon, which, when executed by a computer processor, cause the computer to perform the above-described rapid cigarette length measurement method.
[0033] A fourth aspect of the present invention provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described rapid cigarette length measurement method.
[0034] The beneficial technical effects of this invention are as follows:
[0035] This invention introduces a consistency metric between the principal axis direction and local normal direction based on principal component analysis, and constructs a weighted random sampling mechanism based on direction consistency to guide the generation of the cylindrical model assumption. This prevents the RANSAC segmentation process from blindly sampling uniformly, instead biasing towards the true cylindrical structure of the cigarette stick. This significantly improves the convergence efficiency and segmentation stability in point cloud scenarios with a stage background, tobacco interference, and noise. It enables accurate extraction of the main structure of multiple cigarette sticks and effective suppression of non-cylindrical appendages. At the same time, it abandons the traditional two-dimensional image endpoint or farthest point distance measurement method. Based on the optimal cylinder axis, it performs axial projection on the inner point set and calculates the length using the extreme difference of the projected coordinates. This transforms three-dimensional length measurement into one-dimensional scalar interval estimation under model constraints, significantly reducing measurement errors caused by end face defects, placement tilt, and surface irregularities. It balances non-contact, fast processing, and high measurement accuracy, meeting the real-time and robust requirements of industrial online inspection.
[0036] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0037] The accompanying drawings, incorporated in and forming part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without inventive effort. In the drawings:
[0038] Figure 1 This is a flowchart of the rapid cigarette length measurement method of this application;
[0039] Figure 2 A schematic diagram illustrating data acquisition for the depth camera in this application;
[0040] Figure 3 This is a schematic diagram of the original point cloud data of this application;
[0041] Figure 4 These are comparison images of the point cloud effects after filtering in this application;
[0042] Figure 5 This is a diagram showing the point cloud downsampling effect of this application;
[0043] Figure 6 The image shows the effect of segmenting cigarette point clouds using the improved RANSAC algorithm of this application.
[0044] Figure 7 This is a rendering of the effect before tobacco removal in this application;
[0045] Figure 8 This is a diagram showing the effect after tobacco removal in this application;
[0046] Figure 9 This is a framework diagram of an exemplary rapid cigarette length measurement system of this application;
[0047] Figure 10 This is a framework diagram of another exemplary rapid cigarette length measurement system of this application;
[0048] Figure 11 A schematic diagram of the structure of a computer system suitable for an embodiment of this application is shown. Detailed Implementation
[0049] Unless otherwise defined, all technical and / or scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should be understood that certain features of the invention (described in the context of separate embodiments for clarity) may also be provided in a single embodiment. Conversely, multiple features of the invention (described in the context of a single embodiment for brevity) may also be provided separately or in any suitable combination or, where appropriate, in any other described embodiment of the invention. Certain features described in the context of various embodiments will not be considered essential features of those embodiments unless the embodiment is inoperable without those elements. The invention is further illustrated below by specific examples; however, it should be noted that the specific process conditions and results described in the embodiments of the invention are merely illustrative and should not be construed as limiting the scope of protection of the invention. All equivalent changes or modifications made in accordance with the spirit and essence of the invention should be covered within the scope of protection of the invention.
[0050] Please see Figure 1 The flowchart of the rapid cigarette length measurement method of this application is described in detail below:
[0051] Step S100: Obtain the three-dimensional point cloud data of the cigarette to be detected and perform preprocessing to obtain an optimized point cloud dataset.
[0052] Specifically, the original 3D point cloud data of this application was acquired by 3D scanning of the cigarette using a depth camera. For example... Figure 2 As shown, multiple yellow cylindrical cigarettes are arranged in parallel on a slightly tilted platform. A depth camera is aimed at the area of the cigarettes to be tested from the upper right at a top-down angle. By projecting a pre-coded surface structured light pattern onto the scene being tested, the camera simultaneously acquires deformation images modulated by the surface contours of the cigarettes. Based on the principle of triangulation, the camera calculates the three-dimensional spatial coordinates of each pixel in the field of view. To meet the complete data acquisition needs of cigarettes of different lengths, the depth camera can be smoothly moved along the length of the cigarette to complete the sequential scanning with the help of a linear module. Through high-precision seamless stitching of multiple frames of three-dimensional data, the surface contour data of the entire length range of the cigarettes is efficiently and accurately acquired, ultimately forming complete dense three-dimensional point cloud information.
[0053] More specifically, the data acquisition device of this application is not limited to a depth camera, but may also be other devices that can acquire three-dimensional point clouds of an object surface, such as a 3D laser scanner or a structured light scanner.
[0054] Specifically, the preprocessing in this application includes: adaptive filtering of the 3D point cloud data based on local surface curvature features to distinguish between foreground and background; smoothing the distinguished foreground point cloud data using moving least squares method; and downsampling the smoothed point cloud data to obtain an optimized point cloud dataset. More specifically, the original 3D point cloud data is as follows: Figure 3 As shown, the sample includes various geometric structures such as cigarettes and the stage shell. Adaptive foreground extraction is achieved by utilizing the essential differences in local geometric properties between the target and the background; specifically, the sample is a cylinder, and the stage shell and other components are mostly large-curvature planes. The surface of the cylinder has a constant, non-zero principal curvature, while the curvature of the planar background is almost zero. By calculating and analyzing the local neighborhood curvature features (local surface curvature features) of each point, an adaptive threshold can be set to effectively suppress background points and initially extract a point cloud set of suspected cylinders. The specific formulas satisfy formulas 3 and 4:
[0055] (Formula 3),
[0056] In Formula 3, C represents the covariance matrix; k represents the number of neighborhood points; This represents the three-dimensional coordinate vector of the j-th point; This represents the mean of these k points; Indicates the average coefficient; This represents the offset vector of the j-th point relative to the mean point.
[0057] (Formula 4),
[0058] In formula 4, Represents the curvature at the i-th point; These represent the three eigenvalues calculated after performing principal component analysis (PCA) on the i-th point and its surrounding local neighborhood.
[0059] In this application, the local surface curvature of any point in the point cloud is estimated using a fitted local tangent plane or quadratic surface within the neighborhood of that point. Based on eigenvalue decomposition, this application constructs a covariance matrix C, and then performs eigenvalue decomposition on the covariance matrix C to obtain the curvature. Background point clouds are removed based on differences in curvature. The initially extracted point cloud may still contain scanning noise, outliers, and minor irregularities caused by the cigarette surface material. Directly fitting cylindrical shapes to such data can affect segmentation accuracy and length measurement stability. Moving least squares is a point cloud smoothing and resampling technique based on fitting local higher-order surfaces. Its core idea is to fit a smooth reference surface to each point and its neighborhood, and then project the points onto this surface, thereby achieving noise filtering and surface smoothing while preserving the original geometric features. Specific effects are shown in the figure. Figure 4 As shown.
[0060] Furthermore, this application addresses the cigarette point cloud after adaptive filtering and moving least squares smoothing. To improve the computational efficiency of subsequent segmentation algorithms and meet real-time requirements, this study employs a voxelized grid downsampling method to uniformly simplify the point cloud data. This algorithm first uniformly divides the point cloud space into a series of cubic grids, then aggregates all spatial points within each non-empty voxel, and generates a single representative point by calculating its three-dimensional centroid. Finally, the set of representative points from all voxels constitutes the new downsampled point cloud. This method ensures a uniform reduction in point density across the entire space, avoiding local unevenness. It effectively filters out redundant points and residual noise at the microscopic level. It significantly improves the processing speed of subsequent segmentation and fitting stages, with specific effects as shown below. Figure 5 As shown.
[0061] More specifically, the point cloud smoothing algorithm of this application is not limited to the moving least squares method. In scenarios with slightly lower accuracy requirements, Gaussian filtering or bilateral filtering methods can also be used.
[0062] Step S200: Based on the optimized point cloud dataset, the principal axis direction of the point cloud as a whole is determined by principal component analysis; the consistency metric between the local normal and the principal axis direction of each point in the optimized point cloud dataset is calculated, and the corresponding sampling weight is assigned to the point according to the consistency metric, wherein the point with a higher degree of consistency is assigned a larger sampling weight.
[0063] Specifically, for optimizing point cloud datasets, to accurately segment them into independent single cigarette point cloud clusters while separating tobacco shreds from cigarettes, this application provides an improved Random Sample Consensus (RANSAC) cylinder segmentation algorithm. The classic RANSAC algorithm employs a completely uniform random sampling strategy, which is inefficient when processing cigarette point clouds with obvious spatial distribution patterns, as in this scenario. Therefore, this application introduces a weighted random sampling mechanism based on directional consistency. First, principal component analysis (PCA) is used to determine the overall principal axis direction of the point cloud. Then, during the RANSAC iteration process, the sampling probability (i.e., weighting) of each point is dynamically adjusted based on the consistency between its local normal and the principal axis direction, thereby guiding the model assumptions to converge more quickly to the actual cigarette cylinder. Based on the directional constraint-based weighted sampling mechanism, the formula for calculating the consistency metric of the improved RANSAC algorithm satisfies the following formula 1:
[0064] (Formula 1),
[0065] In formula 1, This represents the consistency metric value of the i-th point; n i v represents the local normal at the i-th point; g This indicates the overall principal axis direction of the point cloud as determined by principal component analysis; A sharpening factor greater than 1; To ensure robustness, use minimal normal numbers.
[0066] Specifically, this application assigns sampling weights to points based on consistency metrics by: establishing a monotonically increasing mapping relationship between consistency metrics and sampling weights, such that points whose local normals are closer to the principal axis direction have a higher probability of being selected as model hypothesis samples; and assigning corresponding sampling weights to each point in the optimized point cloud dataset based on this mapping relationship to form a non-uniform weighted sampling distribution. More specifically, this application maps consistency metrics to sampling weights to guide sampling to converge more quickly to the true cylinder hypothesis, such as... Figure 6 As shown, after segmentation using the method of this application, the axes of each cigarette stick exhibit good consistency, and the point cloud of each cigarette stick is completely and accurately extracted.
[0067] Step S300: The random sampling process is guided by sampling weights. A weighted random sampling mechanism based on directional consistency is used to iteratively generate cylinder model hypotheses. The optimal cylinder model and its corresponding set of interior points are selected based on the number of interior points corresponding to each hypothesis. The cylinder structure representing the main body of the cigarette is extracted by segmentation. The model parameters of the optimal cylinder model include at least the axis direction vector.
[0068] Specifically, this application employs a weighted random sampling mechanism based on directional consistency to iteratively generate the cylindrical model. The assumptions include: in each iteration, selecting the minimum sample point set from the optimized point cloud dataset according to the weighted sampling distribution to generate the cylindrical hypothetical model; fitting the parameter assumptions of the cylindrical model based on the minimum sample point set; calculating the conformity between each point in the optimized point cloud dataset and the parameter assumptions, and dividing each point into in-model points or out-of-model points according to a preset criterion, and counting the number of in-model points as the evaluation index for this iteration; after multiple iterations, determining the parameter assumption with the most in-model points as the optimal cylindrical model, and using its corresponding in-model point set as the main point cloud of the cigarette.
[0069] Specifically, this application, while segmenting and extracting the cylindrical structure representing the main body of the cigarette, also excludes interference points that do not conform to the geometric consistency of the optimal cylindrical model from the set of interior points. These interference points include tobacco shreds, debris, and outlier noise points. More specifically, this application follows a hypothesis-verification iterative framework. In each iteration, the smallest sample set is selected based on weighted probabilities to generate a cylindrical hypothesis model. The conformity between the entire point cloud and this model is calculated, and the number of interior points is recorded. After multiple iterations, the model with the most interior points is selected as the segmentation result, and its corresponding interior point set is the point cloud of a cigarette. During the segmentation of the cigarette, tobacco shreds are filtered out along with the overall cigarette structure, as shown in the following figure. Figure 7 and Figure 8 As shown.
[0070] More specifically, the point cloud segmentation algorithm of this application is not limited to the improved RANSAC algorithm, but may also employ region growing method, semantic segmentation method based on deep learning, etc.
[0071] Step S400: Based on the axis of the optimal cylindrical model, project the corresponding set of interior points onto the axis direction, and calculate and output the cigarette length based on the extreme difference of the projected coordinates.
[0072] Specifically, the measurement method of this application accurately calculates the physical length of each cigarette using the axial projection method of a cylinder. Based on the high-precision cylinder model parameters obtained during the segmentation and optimization stages, this method transforms the length measurement in three-dimensional space into a one-dimensional scalar calculation along the principal axis of the cylinder, thus ensuring measurement accuracy while possessing excellent anti-interference capability and computational efficiency. More specifically, the formula for calculating the cigarette length in this application satisfies the following formula 2:
[0073] (Formula 2),
[0074] In Formula 2, L k t is the length of the k-th cigarette; i Let be the scalar coordinates obtained by projecting the i-th interior point in the interior point set corresponding to the k-th cigarette along the axis of the optimal cylindrical model of that cigarette; the optimal cylindrical model is denoted as . , where a k As a reference point on the axis, u k r is the direction vector of the axis. k The radius of the cylinder is max(t). i ) and min(t i ) are the maximum and minimum values of all scalar projected coordinates of the interior point set, respectively.
[0075] Please see Figure 9 The diagram shows a framework of an exemplary rapid cigarette length measurement system 900 of this application, including:
[0076] The acquisition and preprocessing module 910 is used to acquire the three-dimensional point cloud data of the cigarette to be detected and perform preprocessing to obtain an optimized point cloud dataset;
[0077] The consistency quantization module 920 is used to determine the overall principal axis direction of the point cloud based on the optimized point cloud dataset through principal component analysis; calculate the consistency metric between the local normal and the principal axis direction of each point in the optimized point cloud dataset; and assign corresponding sampling weights to the points according to the consistency metric, wherein the points with higher consistency are assigned greater sampling weights.
[0078] The segmentation and extraction module 930 is used to guide the random sampling process with sampling weights. It iteratively generates cylindrical model hypotheses using a weighted random sampling mechanism based on direction consistency. The optimal cylindrical model and its corresponding set of interior points are selected based on the number of interior points corresponding to each hypothesis. The cylindrical structure representing the main body of the cigarette is extracted by segmentation. The model parameters of the optimal cylindrical model include at least the axis direction vector.
[0079] The calculation module 940 is used to project the corresponding set of interior points onto the axis direction based on the axis of the optimal cylindrical model, and calculate and output the length of the cigarette based on the extreme difference of the projected coordinates.
[0080] Specifically, such as Figure 10 As shown, the system of this application can be configured to execute the aforementioned rapid cigarette length measurement method, and perform non-contact geometric dimension extraction of the cigarette to be tested along the algorithm pipeline of "point cloud data acquisition - data preprocessing - segmentation and measurement - length output". The system of this application follows the logical framework of "preprocessing - segmentation - measurement", and extracts the precise axial length of the cigarette body from the original three-dimensional scanning data by combining point-to-cloud processing with model fitting.
[0081] In its implementation, the acquisition and preprocessing module 910 of this application can receive raw 3D point clouds acquired by a depth camera, structured light scanner, or laser scanning device, and sequentially perform operations such as adaptive smoothing filtering, moving least squares smoothing filtering, and point cloud downsampling. Among these, adaptive filtering based on local surface curvature features can effectively suppress noise and outliers, moving least squares smoothing helps to complete the reconstruction of the point cloud surface and preserve the overall geometric shape, and downsampling is used to optimize the data scale, ultimately providing a high-quality, lightweight point cloud data foundation for subsequent processing.
[0082] The consistency quantification module 920 of this application is used to establish the relationship between local geometric features and global extension trends: the main body of the cigarette is a slender cylindrical structure, and its local normal and the overall main axis direction have a predictable spatial relationship; therefore, the higher the consistency of a point, the more likely it is to belong to the real cigarette support surface, and the greater the sampling weight assigned, thus obtaining a higher probability of being selected in the subsequent sampling process.
[0083] The segmentation and extraction module 930 of this application is used to perform a robust segmentation process under a hypothesis-verification iterative framework: each iteration selects a candidate point set according to a weighted distribution to generate a cylinder parameter hypothesis, calculates the conformity of the full point cloud with the hypothesis, and counts the number of interior points; after multiple iterations, the model with the most interior points is taken as the optimal cylinder model. Thus, interference points that do not conform to the geometric consistency of the cylinder (such as tobacco shreds, debris, and outlier noise) can be naturally eliminated, ensuring the integrity and accuracy of the target model. The model parameters of the optimal cylinder model include at least the axis direction vector, and may further include reference points on the axis and the radius, etc.
[0084] The calculation module 940 of this application can use the axis equation or axis direction vector of the optimal cylindrical model to map each point in the internal point set into one-dimensional scalar projected coordinates along the axis. By calculating the difference between the maximum and minimum values of these scalar coordinates, the length parameter of the cigarette along the axial direction can be obtained. This method can avoid the positioning error in traditional physical endpoint contact measurement and can stably output repeatable and precise measurement results.
[0085] In summary, through the collaborative work of its various modules, the system of this application can form a systematic and repeatable non-contact precision measurement solution for cigarette length, which can achieve efficient and reliable extraction from the original point cloud to the precise geometric dimensions while suppressing background, noise and accessory interference.
[0086] It should be noted that the rapid cigarette length measurement system and the rapid cigarette length measurement method provided in the above embodiments belong to the same concept. The specific operation methods of each module and unit have been described in detail in the method embodiments and will not be repeated here. In practical applications, the rapid cigarette length measurement system provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the system can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.
[0087] Embodiments of this application also provide a computer device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the computer device to implement the rapid cigarette length measurement method provided in the above embodiments.
[0088] Figure 11 A schematic diagram of the structure of a computer system suitable for an embodiment of this application is shown. It should be noted that... Figure 11 The computer system 1100 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0089] like Figure 11As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage section 1108 into a random access memory (RAM) 1103, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in the RAM 1103. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104. The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (local area network) card, modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. Drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as disks, optical disks, magneto-optical disks, semiconductor memories, etc., are installed on drive 1110 as needed so that computer programs read from them can be installed into storage section 1108 as needed.
[0090] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer tool programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1109, and / or installed from removable medium 1111. When the computer program is executed by central processing unit (CPU) 1101, it performs various functions defined in the system of this application.
[0091] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, flash memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. Computer programs contained on computer-readable media can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0093] The units described in the embodiments of this application can be implemented by tools or by hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the unit itself.
[0094] Another aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a computer's processor, causes the computer to perform the rapid cigarette length measurement method described above. This computer-readable storage medium may be included in the computer device described in the above embodiments, or it may exist independently and not incorporated into that computer device.
[0095] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the rapid cigarette length measurement method provided in the various embodiments described above.
[0096] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method for rapid measurement of cigarette length, characterized in that, Includes the following steps: Step S100: Obtain the three-dimensional point cloud data of the cigarette to be detected and perform preprocessing to obtain an optimized point cloud dataset; Step S200: Based on the optimized point cloud dataset, determine the overall principal axis direction of the point cloud through principal component analysis; Calculate the consistency metric between the local normal of each point in the optimized point cloud dataset and the principal axis direction, and assign a corresponding sampling weight to the point based on the consistency metric, wherein the point with a higher degree of consistency is assigned a larger sampling weight; Step S300: Guide the random sampling process with the sampling weight, iteratively generate cylinder model hypotheses using a weighted random sampling mechanism based on direction consistency, and obtain the optimal cylinder model and corresponding set of interior points according to the number of interior points corresponding to each hypothesis, so as to segment and extract the cylinder structure representing the main body of the cigarette; the model parameters of the optimal cylinder model include at least the axis direction vector. Step S400: Based on the axis of the optimal cylindrical model, project the corresponding set of interior points onto the axis direction, and calculate and output the cigarette length according to the extreme difference of the projected coordinates.
2. The rapid cigarette length measurement method according to claim 1, characterized in that, In step S100, the preprocessing includes: The three-dimensional point cloud data is adaptively filtered based on local surface curvature features to distinguish between foreground and background; the distinguished foreground point cloud is then smoothed using moving least squares filtering, and the smoothed point cloud is downsampled to obtain the optimized point cloud dataset.
3. The rapid cigarette length measurement method according to claim 1, characterized in that, In step S200, the formula for calculating the consistency metric value satisfies the following formula 1: (Official 1), In formula 1, This represents the consistency metric value of the i-th point; n i v represents the local normal at the i-th point; g This indicates the principal axis direction of the point cloud as a whole, as determined by principal component analysis. A sharpening factor greater than 1; To ensure robustness, use minimal normal numbers.
4. The rapid cigarette length measurement method according to claim 1, characterized in that, In step S200, assigning a corresponding sampling weight to the point based on the consistency metric value includes: A monotonically increasing mapping relationship is established between the consistency metric and the sampling weights, so that the closer the local normal is to the principal axis direction, the higher the probability that a point will be selected as a model hypothesis sample. Based on this mapping relationship, each point in the optimized point cloud dataset is assigned a corresponding sampling weight to form a non-uniform weighted sampling distribution.
5. The rapid cigarette length measurement method according to claim 4, characterized in that, In step S300, the cylinder model is iteratively generated using a weighted random sampling mechanism based on directional consistency, based on the following assumptions: In each iteration, the minimum sample point set for generating the cylindrical hypothetical model is selected from the optimized point cloud dataset according to the weighted sampling distribution; the parameter hypothesis of the cylindrical model is obtained by fitting the minimum sample point set; the conformity of each point in the optimized point cloud dataset with the parameter hypothesis is calculated, and each point is divided into in-model points or out-of-model points according to a preset criterion, and the number of in-model points is counted as the evaluation index of this iteration; after multiple iterations, the parameter hypothesis with the most in-model points is determined as the optimal cylindrical model, and its corresponding in-model point set is used as the main point cloud of the cigarette.
6. The rapid cigarette length measurement method according to claim 5, characterized in that, In step S300, while segmenting and extracting the cylindrical structure that characterizes the main body of the cigarette, interference points that do not conform to the geometric consistency of the optimal cylindrical model are also excluded from the set of internal points. The interference points include tobacco shreds, debris, and outlier noise points.
7. The rapid cigarette length measurement method according to claim 1, characterized in that, In step S400, the formula for calculating the length of the cigarette satisfies the following formula 2: (Official 2), In Formula 2, L k t is the length of the k-th cigarette; i The scalar coordinates are obtained by projecting the i-th interior point in the interior point set corresponding to the k-th cigarette along the axis of the optimal cylindrical model of that cigarette; the optimal cylindrical model is denoted as... , where a k As a reference point on the axis, u k r is the direction vector of the axis. k The radius of the cylinder is max(t). i ) and min(t i ) are the maximum and minimum values of all scalar projected coordinates of the interior point set, respectively.
8. A rapid cigarette length measurement system, characterized in that, include: The acquisition and preprocessing module is used to acquire the three-dimensional point cloud data of the cigarette to be detected and perform preprocessing to obtain an optimized point cloud dataset; The consistency quantization module is used to determine the overall principal axis direction of the point cloud based on the optimized point cloud dataset through principal component analysis. Calculate the consistency metric between the local normal of each point in the optimized point cloud dataset and the principal axis direction, and assign a corresponding sampling weight to the point based on the consistency metric, wherein the point with a higher degree of consistency is assigned a larger sampling weight; The segmentation and extraction module is used to guide the random sampling process with the sampling weights, iteratively generate cylindrical model hypotheses using a weighted random sampling mechanism based on directional consistency, and select the optimal cylindrical model and corresponding set of interior points according to the number of interior points corresponding to each hypothesis, so as to segment and extract the cylindrical structure that represents the main body of the cigarette; the model parameters of the optimal cylindrical model include at least the axis direction vector. The calculation module is used to project the corresponding set of interior points onto the axis direction based on the axis of the optimal cylindrical model, and calculate and output the length of the cigarette based on the extreme difference of the projected coordinates.
9. A computer-readable storage medium, characterized in that, It stores computer-readable instructions, which, when executed by the computer's processor, cause the computer to perform the rapid cigarette length measurement method according to any one of claims 1 to 7.
10. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the steps of the rapid cigarette length measurement method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Cigarette end face physical defect automatic detection method and system and storage medium
CN121453791A