Tobacco leaf blade extraction method based on threshold mask and linear iterative clustering, tobacco chemical component nondestructive determination method and device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHENGZHOU TOBACCO RES INST OF CNTC
- Filing Date
- 2026-05-11
- Publication Date
- 2026-07-14
Smart Images

Figure CN122391587A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chemical composition determination technology, specifically to a method for extracting tobacco leaf components based on threshold masking and linear iterative clustering, and a non-destructive method and apparatus for determining the chemical composition of tobacco leaves. Background Technology
[0002] The chemical composition of tobacco leaves directly affects their aroma, flavor, and smoking quality. Therefore, accurate determination of tobacco leaf chemical components is crucial for tobacco quality control and formulation optimization. Traditional chemical analysis methods mainly rely on laboratory analytical techniques such as gas chromatography (GC), high-performance liquid chromatography (HPLC), and mass spectrometry (MS). Although these methods can provide high-precision quantitative analysis, they are generally characterized by complex operation, long analysis cycles, high reagent consumption, and high detection costs, making it difficult to meet the needs of large-scale, rapid detection. In addition, laboratory analytical methods usually require destructive sampling, limiting their application in real-time online monitoring.
[0003] In recent years, spectroscopic analysis technology has been widely used in the field of agricultural product quality testing due to its advantages of speed and non-destructiveness. Among them, near-infrared spectroscopy (NIRS) has been used for the rapid prediction of chemical components in tobacco leaves. Zhang Zhongfeng et al. established a mathematical model based on NIRS to effectively predict the main chemical components in tobacco leaves, such as total alkaloids, total sugars, reducing sugars, total nitrogen, potassium, and chlorine. Hu Yun et al. used online NIRS technology to detect the chemical components of re-dried tobacco leaves in real time and constructed a corresponding analytical model. Li Dongliang et al. further explored the NIRS quantitative analysis method for the main chemical components of tobacco. However, NIRS technology still has certain limitations, such as a narrow spectral range, low spectral resolution, sensitivity to moisture and particle size, and the fact that samples usually need to be ground before testing. These factors affect its applicability in the analysis of complex components.
[0004] Hyperspectral imaging (HSI) technology integrates spectral analysis and imaging techniques, simultaneously acquiring spectral and spatial information of samples across multiple continuous wavelengths, enabling it to characterize the composition, structure, and distribution features of target substances. In recent years, HSI technology has shown great potential in tobacco leaf quality grading, non-tobacco substance detection, and disease identification. Compared to NIRS, HSI offers a wider spectral coverage and higher spectral resolution, reduces the impact of moisture and particle size on spectral data, and boasts advantages such as non-destructive operation, no sample pretreatment required, and suitability for large-scale detection, making it of significant application value in the rapid detection of chemical components in tobacco leaves.
[0005] Hyperspectral images contain rich spectral and spatial information. To ensure the accuracy of the analysis, background removal and data preprocessing are necessary to extract effective tobacco leaf spectral information. Traditional methods for extracting Regions of Interest (ROIs) mainly involve manual drawing using ENVI software or a masking method based on a fixed threshold. Manual drawing methods rely on human operation, are inefficient, and highly subjective; while threshold masking methods typically set a fixed threshold based on a single band, making it difficult to accurately identify tobacco leaf regions and failing to consider the influence of non-uniform structures such as veins and wrinkles on the spectral data.
[0006] In order to solve the above problems, people have been seeking an ideal technological solution. Summary of the Invention
[0007] Therefore, it is necessary to provide a method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering, as well as a method and apparatus for non-destructive determination of the chemical components of tobacco leaves, in order to address the above-mentioned technical problems.
[0008] To achieve the above objectives, the first aspect of the present invention provides a method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering, comprising the following steps:
[0009] Hyperspectral images of tobacco leaves were acquired, and a masking method combining single-band thresholding and reflectance difference fusion was used to coarsely extract the main tobacco leaf region from the hyperspectral images.
[0010] An improved linear iterative clustering method was used to finely segment the main tobacco leaf region extracted from the coarse data, thereby obtaining the leaf region.
[0011] A masking method using single-band thresholding and reflectance difference fusion is employed to coarsely extract the main tobacco leaf region from hyperspectral images, including the following steps:
[0012] The reflectance value of a specific band is used as a mask threshold to perform masking processing on the hyperspectral image to obtain the foreground region;
[0013] The difference between the maximum and minimum reflectance of each pixel in the foreground region within a specific wavelength range is calculated, and the reflectance differences of each pixel are sorted by size. The reflectance difference with the highest value in the sorted range is selected as the dynamic threshold to perform thresholding on the foreground region, generating a mask image with a non-uniform structure. Based on the mask image with a non-uniform structure, the foreground region is processed to remove the non-uniform structure and obtain the main tobacco leaf region.
[0014] In one possible embodiment, an improved linear iterative clustering method is used to refine the coarsely extracted tobacco leaf body region, resulting in a leaf region comprising:
[0015] The main tobacco leaf region is divided into superpixel regions of uniform size. The center point of each superpixel region is selected as the initial cluster center. It is determined whether the initial cluster center is located within the main tobacco leaf region. If not, a new initial cluster center is searched within its neighborhood until it is located within the main tobacco leaf region.
[0016] Clustering is performed within a preset search range of the initial cluster centers. The distance between each pixel and all its neighboring cluster centers within the preset search range is calculated based on spectral cosine similarity and spatial distance. The cluster center closest to each pixel is selected and the pixel is assigned to the cluster center closest to it. After one round of iteration, the cluster centers are recalculated based on the current superpixel partition.
[0017] Repeat the previous step until the position of the cluster center no longer changes significantly. Then, post-process the obtained superpixel region to obtain the leaf region.
[0018] In one possible embodiment, after filtering out the cluster center closest to each pixel, it is further determined whether the distance between each pixel and its nearest cluster center meets the high distance threshold for abnormal pixels. If it does, the pixel is marked as an abnormal point; otherwise, the pixel is classified into the same category as its nearest cluster center.
[0019] In one possible embodiment, when post-processing the obtained superpixel regions, it is determined whether the area of each superpixel region is less than a set area threshold. If it is less than the set area threshold, it is further determined whether the difference in spectral characteristics between the superpixel region and the adjacent superpixel regions exceeds a preset difference range.
[0020] If the difference in spectral features is greater than the similarity range, the superpixel region is identified as an abnormal region and removed.
[0021] In response to the spectral feature difference being within the similarity range, the superpixel region is merged into the neighboring superpixel region with the most similar spectral features, where the similarity range is smaller than the anomaly range;
[0022] In response to a spectral feature difference less than the similarity range, the superpixel region is marked as background and removed.
[0023] The spectral feature difference is calculated based on the mean feature vector of the two superpixel regions in the multi-band spectral data.
[0024] To achieve the above objectives, a second aspect of the present invention provides a non-destructive method for determining the chemical components of tobacco leaves based on hyperspectral imaging, comprising the following steps:
[0025] A hyperspectral image of the tobacco leaf sample to be measured is acquired, and the region of interest is extracted from the hyperspectral image based on the tobacco leaf extraction method described in the first aspect to obtain the leaf region.
[0026] The leaf region was preprocessed using standard preprocessing methods, and principal component analysis was used to extract features from the preprocessed leaf region.
[0027] The extracted feature vectors are input into the hyperspectral multi-chemical component prediction model to obtain the determination results of various chemical components.
[0028] In one possible embodiment, the steps for obtaining the hyperspectral multi-chemical composition prediction model include:
[0029] Hyperspectral images and multiple chemical composition data of tobacco leaf samples from different production areas, of the same variety, and of different grades were obtained. Abnormal hyperspectral images were removed using Mahalanobis distance, and the effective hyperspectral images were divided into training and testing sets.
[0030] For each hyperspectral image, the leaf image is segmented and extracted based on the tobacco leaf extraction method described in Example 1. Multiple preprocessing methods are used to preprocess the leaf region, and principal component analysis is selected to extract features from the preprocessed leaf region.
[0031] A hyperspectral multi-chemical component prediction model is constructed based on a partial least squares regression model. The output of the hyperspectral multi-chemical component prediction model is the content of various chemical components in a tobacco leaf sample, and the input is a feature vector extracted from the leaf image of the hyperspectral image corresponding to the tobacco leaf sample.
[0032] The hyperspectral multi-chemical composition prediction model was iteratively trained using the training set, and the optimal number of principal components, regression coefficient matrix and latent variable weight vector were determined by K-fold cross-validation.
[0033] Based on the performance of the hyperspectral multi-chemical composition prediction model under different preprocessing methods, the optimal preprocessing method was selected as the standard preprocessing method.
[0034] The hyperspectral multi-chemical composition prediction model trained using the optimal preprocessing method was tested using a test set.
[0035] In one possible embodiment, the plurality of chemical components includes one or more of total alkaloids, total sugars, reducing sugars, total nitrogen, potassium, and chlorine.
[0036] In one possible embodiment, after obtaining the chemical composition determination results, a chemical composition inversion image is generated based on the chemical composition determination results.
[0037] To achieve the above objectives, a third aspect of the present invention provides a tobacco leaf segmentation and extraction device based on threshold masking and linear iterative clustering, comprising:
[0038] The image acquisition module is used to acquire hyperspectral images of tobacco leaves;
[0039] The threshold segmentation module is used to coarsely extract the main tobacco leaf region from the hyperspectral image using a mask method that combines single-band thresholding and reflectance difference fusion.
[0040] The linear iterative clustering segmentation module is used to improve the linear iterative clustering method to perform fine segmentation of the coarsely extracted tobacco leaf main body region to obtain the leaf region.
[0041] To achieve the above objectives, a fourth aspect of the present invention provides a non-destructive device for determining the chemical composition of tobacco leaves based on hyperspectral imaging, comprising:
[0042] The region of interest extraction module is used to extract the region of interest from the hyperspectral image of the tobacco leaf sample to be measured based on the tobacco leaf extraction method described in Example 1, so as to obtain the leaf region.
[0043] The preprocessing module is used to preprocess the blade region based on standard preprocessing methods;
[0044] The feature extraction module is used to extract features from the preprocessed leaf region using principal component analysis.
[0045] The measurement result acquisition module is used to identify feature vectors by a hyperspectral prediction model built based on a partial least squares regression model, and obtain measurement results of various chemical components.
[0046] To achieve the above objectives, a fifth aspect of the present invention provides a computer device, characterized in that it includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0047] Memory, used to store computer programs;
[0048] The processor, when executing a program stored in memory, implements the steps of the tobacco leaf extraction method as described in the first aspect, or the steps of the non-destructive determination method of tobacco chemical components as described in the second aspect.
[0049] To achieve the above objectives, a sixth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the tobacco leaf extraction method as described in the first aspect, or the steps of the non-destructive determination method of tobacco chemical components as described in the second aspect.
[0050] To achieve the above objectives, a seventh aspect of the present invention provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of the tobacco leaf extraction method as described in the first aspect, or the steps of the non-destructive determination method for the chemical components of tobacco leaves as described in the second aspect.
[0051] The beneficial effects of this invention are as follows:
[0052] (1) This invention optimizes the region of interest extraction method, combining threshold mask and SLIC superpixel segmentation to improve the accuracy of background removal and outlier removal; specifically, the single-band threshold segmentation mask method is used to segment the foreground image and background region to reduce background interference; the dynamic threshold mask method based on spectral difference analysis effectively removes the leaf vein region in the foreground image to achieve coarse extraction of the main tobacco leaf region; further, the SLIC method is introduced for fine segmentation and outlier removal to further remove background interference and local outliers that were not completely removed in the threshold mask, thereby more effectively adapting to the complex spectral and texture features of tobacco leaves and significantly improving the accuracy and effectiveness of ROI extraction;
[0053] (2) This invention utilizes hyperspectral imaging technology to achieve pixel-level non-destructive detection of chemical components in tobacco leaves, overcoming the limitations of traditional NIRS methods;
[0054] (3) A unified modeling strategy for multiple chemical components is proposed. Specifically, a unified prediction model for multiple chemical components is established based on FD preprocessing + principal component analysis (PCA) dimensionality reduction + partial least squares regression (PLSR) + K-fold cross-validation to improve modeling efficiency and model generalization ability.
[0055] These innovations provide new technical means for the accurate detection and efficient evaluation of tobacco leaf quality, laying the foundation for quality control and formulation optimization in the tobacco industry. Attached Figure Description
[0056] Figure 1 This is a schematic flowchart of the tobacco leaf extraction method of the present invention;
[0057] Figure 2 This is a schematic diagram showing the extraction results of leaf regions of tobacco leaves using different tobacco leaf extraction methods;
[0058] Figure 3 This is a schematic flowchart of the non-destructive determination method for chemical components of tobacco leaves according to the present invention;
[0059] Figure 4 This is a schematic diagram showing the average spectral reflectance and error bands before and after removing the region of interest.
[0060] Figure 5 This is a schematic diagram showing the changes in spectral curves after the original spectral data has undergone different preprocessing methods.
[0061] Figure 6 Scatter plots of predicted versus actual chemical composition values on the training and test sets;
[0062] Figure 7 It is an image of the chemical composition of tobacco leaf surface;
[0063] Figure 8 It is a block diagram of computer equipment. Detailed Implementation
[0064] The technical solution of the present invention will be further described in detail below through specific embodiments.
[0065] To facilitate understanding, the interactive parties and / or terms and / or custom terms involved in this invention will first be explained in conjunction with the technical solution of this invention:
[0066] The Linear Iterative Clustering (SLIC) superpixel algorithm utilizes a simple (greedy) clustering algorithm. Initially, the centers of each cluster are evenly distributed across the image, and the number of superpixels can be largely determined by these center points. In each iteration, the seed pixel merges with surrounding pixels to form a superpixel. SLIC can better capture boundaries, and it also boasts faster speed, higher memory efficiency, and improved segmentation performance. It can also be directly extended to supercell generation.
[0067] Example 1
[0068] This embodiment provides a method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering, such as... Figure 1 As shown, it includes the following steps:
[0069] Hyperspectral images of tobacco leaves were acquired, and a masking method combining single-band thresholding and reflectance difference fusion was used to coarsely extract the main tobacco leaf region from the hyperspectral images.
[0070] An improved linear iterative clustering method was used to finely segment the main tobacco leaf region extracted from the coarse data, thereby obtaining the leaf region.
[0071] Specifically, hyperspectral images contain rich spectral and spatial information. To ensure the accuracy of the analysis, background removal and data preprocessing are required to extract effective tobacco leaf spectral information. Traditional methods for extracting regions of interest (ROIs) mainly employ manual drawing using ENVI software or a masking method based on a fixed threshold. Manual drawing methods rely on human operation, resulting in low efficiency and high subjectivity; while threshold masking methods typically set a fixed threshold based on a single band, making it difficult to accurately identify tobacco leaf regions and failing to consider the influence of non-uniform structures such as veins and wrinkles on the spectral data.
[0072] Therefore, this embodiment proposes a tobacco leaf extraction method based on threshold masking and linear iterative clustering. Threshold segmentation is performed using a masking method that fuses single-band thresholds and reflectance differences to achieve background removal and the identification and removal of leaf veins and wrinkles. An improved linear iterative clustering method is then used for superpixel segmentation of the main tobacco leaf region to further remove background areas and local anomalies, thereby improving the accuracy and stability of the Region of Interest (ROI). Compared with deep learning methods, this method requires no large amount of labeled data, has higher computational efficiency, and is suitable for large-scale hyperspectral data processing.
[0073] Specifically, a masking method using single-band thresholding and reflectance difference fusion is employed to coarsely extract the main tobacco leaf region from hyperspectral images, including the following steps:
[0074] The reflectance value of a specific band is used as a mask threshold to perform masking processing on the hyperspectral image to obtain the foreground region;
[0075] The difference between the maximum and minimum reflectance of each pixel in the foreground region within a specific wavelength range is calculated, and the reflectance differences of each pixel are sorted by size. The reflectance difference with the highest value in the sorted range is selected as the dynamic threshold to perform thresholding on the foreground region, generating a mask image with a non-uniform structure. Based on the mask image with a non-uniform structure, the foreground region is processed to remove the non-uniform structure and obtain the main tobacco leaf region.
[0076] It is important to note that the bands and thresholds of hyperspectral images captured by different hyperspectral image acquisition devices will vary. These can be set according to the specific circumstances. In this embodiment, the fifth band with a reflectance value less than 0.35 is used as a mask for initial threshold segmentation. Specifically, this embodiment uses near-infrared spectra acquired by a visible-near-infrared hyperspectral imager, and divides the near-infrared hyperspectral spectrum from 1000-2200nm into 240 bands in 5nm increments. The fifth band is approximately at 1025nm.
[0077] It is understandable that using reflectance values from a specific spectral band for initial thresholding can remove background or low-reflectance areas, but its ability to distinguish complex backgrounds and local features is limited due to relying on information from only a single spectral band. To improve segmentation, this embodiment further introduces a spectral difference calculation method: analyzing the difference between the maximum and minimum reflectance of each pixel within a specific spectral range (e.g., 1100-1250 nm and 1250-1500 nm) to assess the magnitude of spectral variation with wavelength. Since different tissue structures (e.g., leaves, veins, and wrinkles) exhibit different spectral variation characteristics within this range, high spectral difference regions typically correspond to edges, areas with rich textures, or areas with significant chemical composition variations. Subsequently, pixels are sorted according to the magnitude of the spectral differences, and the highest reflectance differences are selected as dynamic thresholds. For example, the top 3% of regions with the highest variation are selected as dynamic thresholds to filter out pixels with obvious spectral characteristics (e.g., non-uniform structures such as veins and wrinkles), and masks are generated for removal to reduce the impact of non-uniform structural regions on the spectral data.
[0078] It can be seen that, compared with the traditional fixed threshold method, processing hyperspectral images by combining preliminary single-band threshold segmentation with spectral difference analysis mask can not only effectively remove background and reduce background interference, but also further optimize the extraction of leaf regions to extract the main areas of tobacco leaves.
[0079] Due to the complex textures, wrinkles, and local anomalies on the surface of tobacco leaves, the threshold mask method has certain limitations in fine segmentation and outlier removal. This embodiment, based on threshold mask extraction, further introduces the SLIC method for finer segmentation and outlier removal. Specifically, this embodiment employs an adaptive superpixel segmentation strategy, which iteratively updates cluster centers and dynamically adjusts the neighborhood search range to gradually remove outlier points, thereby achieving adaptive outlier removal.
[0080] Specifically, an improved linear iterative clustering method is used to finely segment the coarsely extracted tobacco leaf main body region to obtain the leaf region, including:
[0081] The main tobacco leaf region is divided into superpixel regions of uniform size, and the center point of each superpixel region is selected as the initial cluster center. It is determined whether the initial cluster center is located within the main tobacco leaf region. If it is not located, a new initial cluster center is searched in its neighborhood until it is located within the main tobacco leaf region, thus avoiding the interference of outliers on the initial clustering results.
[0082] Clustering is performed within a preset search range of the initial cluster centers. The distance between each pixel and all its neighboring cluster centers within the preset search range is calculated based on a combination of spectral cosine similarity and spatial distance. The cluster center closest to each pixel is selected, and the pixel is assigned to the cluster of its closest cluster center. After one iteration, the cluster centers are recalculated based on the current superpixel partition. Typically, the preset search range is 1.5 * S, where S is the initial step size of the superpixel.
[0083] Repeat the previous step until the position of the cluster center no longer changes significantly. Then, post-process the obtained superpixel region to obtain the leaf region.
[0084] The formula for calculating spectral cosine similarity is as follows:
[0085] The formula for calculating spatial distance is:
[0086] The formula for calculating the total distance is:
[0087] Where p is the spectral vector of a pixel with coordinates (x, y), and c is the spectral vector of the cluster center with coordinates (x, y). C ,y C S represents the superpixel spacing, and m represents the weighting factors for spectral and spatial distance.
[0088] Unlike traditional SLIC which relies solely on Euclidean distance, this embodiment combines spectral cosine similarity and spatial distance to measure the similarity between pixels and superpixel centers. Spectral cosine similarity can better capture the spectral features of hyperspectral data, thereby improving the accuracy of superpixel segmentation. Simultaneously, after each iteration, cluster centers are recalculated based on the current superpixel segmentation to ensure they more closely match the actual leaf regions, resulting in a more uniform superpixel distribution.
[0089] It is important to note that during the iterative update process, the improved SLIC algorithm calculates the similarity between pixels and cluster centers based on a comprehensive weighting of spectral and spatial distance, and dynamically adjusts pixel affiliation within a local range. By continuously updating the spectral mean and spatial location of the cluster centers, the superpixel regions gradually stabilize.
[0090] Furthermore, after filtering out the cluster center closest to each pixel, it is further determined whether the distance between each pixel and its nearest cluster center meets the high distance threshold for abnormal pixels. If it does, the pixel is marked as an abnormal point, such as a background area or an invalid area; otherwise, the pixel is classified into the same category as its nearest cluster center.
[0091] For example, if a pixel p is ranked in the bottom 15% after sorting the distance D between it and the centers of all its neighboring superpixels, then the pixel is considered an outlier and is removed.
[0092] It is understood that the improved SLIC algorithm in this embodiment achieves superpixel segmentation through three methods: initialization threshold constraint, outlier filtering, and distance-weighted clustering, thereby removing background and abnormal interference from the final superpixel segmentation result.
[0093] Furthermore, in this embodiment, a single-band thresholding method is first used to remove most of the background, then an improved linear iterative clustering method is used to optimize the segmentation, and finally anomaly detection is used to remove residual noise, thereby obtaining the effective tobacco leaf area with background, anomalies, leaf veins, and stems removed.
[0094] Furthermore, in this embodiment, when post-processing the obtained superpixel regions, it is determined whether the area of each superpixel region is less than a set area threshold. If it is less than the set area threshold, it is further determined whether the difference in spectral characteristics between the superpixel region and the adjacent superpixel regions exceeds a preset difference range.
[0095] If the difference in spectral features is greater than the similarity range, the superpixel region is identified as an abnormal region and removed.
[0096] In response to the spectral feature difference being within the similarity range, the superpixel region is merged into the neighboring superpixel region with the most similar spectral features, where the similarity range is smaller than the anomaly range;
[0097] In response to a spectral feature difference less than the similarity range, the superpixel region is marked as background and removed.
[0098] The spectral feature difference is calculated based on the mean feature vector of the two superpixel regions in the multi-band spectral data.
[0099] It is understood that superpixel regions with a small number of pixels are usually composed of noise or local anomalies, and their area is smaller than a set area threshold (e.g., less than 20 pixels). For these regions, this embodiment attempts to merge them into neighboring larger regions and directly remove anomaly pixels from extremely small regions to avoid noise regions affecting the overall segmentation result. This merging method effectively eliminates fragmented regions generated during segmentation by combining area threshold constraints with spectral feature matching, while preserving the integrity of the tobacco leaf body.
[0100] Furthermore, when the spectral feature difference is within the similarity range and a merging operation is required, the nearest adjacent superpixel region in spatial distance can be selected as the merging target.
[0101] Furthermore, the improved SLIC algorithm further optimizes the region boundaries in subsequent iterations, gradually eliminating previously isolated outliers during the adaptive adjustment process, thus ensuring the smoothness and consistency of the overall segmentation results.
[0102] Overall, the improved SLIC method smoothly removes outliers by iteratively adjusting the center point and the search neighborhood, ultimately achieving a state where no obvious anomalies exist in any local region, thus enabling more refined and adaptive outlier removal. Through secondary optimization of the improved SLIC method, background interference and local outliers that were not completely removed by the threshold masking method are further eliminated, allowing it to more effectively adapt to the complex spectral and textural features of tobacco leaves, thereby significantly improving the accuracy and effectiveness of leaf region extraction.
[0103] To verify the effectiveness of the leaf region extraction method proposed in this study, GAN-SA-UNet was used as a control. GAN-SA-UNet, based on generative adversarial networks and spatial attention mechanisms, can accurately capture the complex texture features of tobacco leaf veins. Therefore, this study used its segmentation results as a standard to compare the effectiveness of this method in leaf vein extraction, background removal, and outlier removal.
[0104] Figure 2 This demonstrates the extraction results of tobacco leaf regions using different methods, from Figure 2 As can be seen, this method can accurately remove the background, leaf veins and wrinkled areas while maintaining the integrity of the main tobacco leaf area.
[0105] In terms of background removal, the threshold-based segmentation method can effectively remove non-tobacco leaf areas. The correlation between the spectral data before and after processing reached 0.9641, indicating that the background removal process can maintain the stability of spectral data while removing invalid areas, and does not affect the accuracy of subsequent spectral analysis.
[0106] For leaf vein removal and local elimination, this study employs a region of interest extraction method combining threshold segmentation and linear iterative clustering (SLIC) algorithm. While removing leaf veins, the method also considers the influence of leaf wrinkles, shadows, and folds to ensure the purity and reliability of the spectral data. The method first detects leaf vein regions by detecting changes in spectral reflectance and generates a mask for removal. Subsequently, the SLIC algorithm is used to adaptively optimize superpixel segmentation, further enhancing the integrity of the leaf region. Experimental results show that this method can effectively remove the interference of non-uniform structures on spectral data, making the final extracted spectral data more representative.
[0107] Example 2
[0108] This embodiment proposes a non-destructive method for determining the chemical components of tobacco leaves based on hyperspectral imaging. The chemical components include total alkaloids (NIC), total sugars (TS), reducing sugars (RS), total nitrogen (Tkn), potassium (K), and chloride (CL).
[0109] like Figure 3 As shown, the specific measurement method includes the following steps:
[0110] Step 1: Obtain a hyperspectral image of the tobacco leaf sample to be measured. Based on the tobacco leaf extraction method described in Example 1, extract the region of interest from the hyperspectral image to obtain the leaf region.
[0111] Specifically, a hyperspectral imaging system consisting of a GalaFeld-V10E-AZ4 visible-near-infrared hyperspectral imager and an Image-λ-N25E-HS short-wave hyperspectral imager was used to acquire hyperspectral images of the tobacco leaf samples to be tested. The spectral resolution was 5.4 nm, and the spatial resolution was 384 × 893 px. An OLES30 imaging lens (Middleton SpectralVision), four 50W halogen lamps provided uniform illumination, a motorized precision platform ensured uniform sample movement, and a dedicated darkroom reduced ambient light interference.
[0112] Understandably, to ensure the stability of spectral data, the tobacco leaf samples to be measured are placed in a constant temperature and humidity chamber and equilibrated for 48 hours at 45℃ and 80% humidity before acquisition to reduce the impact of moisture fluctuations on the spectral signal. Subsequently, the tobacco leaf samples are removed, the leaves are flattened as much as possible, and placed in a darkroom system for spectral acquisition to minimize external light interference.
[0113] The data acquisition software SpecView is used to set the acquisition parameters. In this embodiment, the camera exposure time is set to 12ms, the forward speed of the motorized moving platform is set to 1.5cm / s, and the retraction speed is set to 2.0cm / s to ensure uniform and stable spectral data acquisition. During the acquisition process, the light source intensity is adjusted to avoid image overexposure and reduce the influence of ambient light to obtain high-quality spectral data.
[0114] To eliminate light intensity fluctuations and camera dark current noise, black and white board calibration is required after data acquisition. First, the spectral reflectance of a 99% standard white board is acquired to obtain a white board calibration image (W). Then, a black board calibration image (B) is acquired by blocking the lens. Finally, the original hyperspectral image (I) is calibrated using the following formula to obtain standardized reflectance data:
[0115] (1)
[0116] Where R is the corrected reflectance image, I is the original acquired hyperspectral image, B is the blackboard reference image, and W is the whiteboard reference image.
[0117] It is understandable that all hyperspectral data acquisition and correction were completed using SpecView software to ensure the consistency and comparability of data quality, providing accurate and reliable input data for subsequent analysis.
[0118] It is understood that the automatic leaf region extraction method described in Example 1 can effectively reduce spectral distortion caused by leaf wrinkles, shadows or leaf vein structure, making the finally extracted leaf region more stable.
[0119] also, Figure 4 This paper presents the hyperspectral images of tobacco leaf samples obtained using the method described in Example 1, and compares the spectral mean and error bands before and after removing leaf veins and abnormal regions based on the tobacco leaf extraction method described in Example 1. It can be seen that after removing leaf veins and abnormal regions, the spectral mean curve is smoother, and the error band range is reduced, indicating improved data consistency while preserving key spectral information.
[0120] This result demonstrates that the tobacco leaf extraction method described in Example 1 can not only effectively remove invalid regions, but also ensure the spectral representativeness of the leaf region, improve data quality, provide a higher quality dataset for subsequent modeling, and enhance the reliability of component prediction.
[0121] Step 2: Preprocess the leaf region based on the standard preprocessing method, and use principal component analysis to extract features from the preprocessed leaf region.
[0122] Hyperspectral data may be affected by instrument drift, ambient light variations, and scattering effects during acquisition, resulting in noise, baseline drift, and non-uniformity in the spectral signals. Therefore, appropriate preprocessing methods are needed to optimize the spectral data to improve its stability and signal-to-noise ratio. Common preprocessing methods include Standard Normal Variation (SNV), Savitzky-Golay filtering (SG filtering), Multiple Scatter Correction (MSC), First Derivative (FD), and Second Derivative (SD).
[0123] The SNV method reduces spectral drift caused by particle scattering by standardizing the spectral data, making the data more uniform. SG filtering uses smoothing algorithms to reduce high-frequency noise interference while maintaining the overall trend of the spectral curve, improving spectral clarity. The MSC method improves the consistency of spectral data by eliminating baseline drift and light scattering effects. The FD and SD methods enhance subtle spectral features by calculating the first or second derivative of the spectrum, making absorption peaks and troughs more prominent. FD is suitable for enhancing weak signals and highlighting subtle spectral changes, while SD further eliminates baseline drift, making local spectral variations more prominent, and is suitable for analyzing chemical components with complex spectral feature distributions. See details... Figure 5 .
[0124] Considering the potential synergistic effects among the chemical components, modeling each component individually would be inefficient and costly due to the inability to effectively utilize spectral data. To improve modeling efficiency and data utilization, this embodiment attempts a unified modeling strategy, simultaneously predicting the contents of six chemical components—total alkaloids (NIC), total sugars (TS), reducing sugars (RS), total nitrogen (Tkn), potassium (K), and chloride (CL)—based on the same spectral data. Since different preprocessing methods can affect the morphology of spectral curves and subsequent modeling results, this embodiment further evaluates the performance of the unified model, as shown in Table 1, to select the optimal preprocessing method. Specifically, the basic model for the unified modeling is a partial least squares regression (PLSR) model. Model performance evaluation indicators include the correlation coefficient (R²) and the root mean square error of cross-validation (RMSECV). R² measures the correlation between predicted and measured values; a closer R² is to 1 indicates a better model fit. RMSECV measures the model error; a smaller RMSECV value indicates higher accuracy and reliability.
[0125] Specifically, the formulas for calculating R² and RMSECV are as follows:
[0126] (2)
[0127] (3)
[0128] Table 1. Impact of different preprocessing methods on model performance (unified modeling)
[0129]
[0130] Table 1 shows the unified modeling results under different preprocessing methods. As can be seen from Table 1, the R² values of NIC, TS, RS, and Tkn all exceed 0.89, indicating that the unified model has a strong predictive ability for these components. However, the predictive performance of potassium (K) and chloride (CL) is relatively low, which may be related to their weak spectral characteristics, information redundancy, or uneven data distribution.
[0131] To further verify this, this embodiment evaluated the effects of different pretreatment methods on the modeling of total alkaloids (NIC), total sugars (TS), reducing sugars (RS), total nitrogen (Tkn), potassium (K), and chloride (CL), resulting in Table 2.
[0132] Table 2. Impact of different preprocessing methods on model performance (modeling separately)
[0133]
[0134] It can be seen that, under FD preprocessing, the R² values of NIC, TS, RS, and Tkn when modeling separately are similar to those of the unified modeling result, and the prediction performance of potassium K and chloride Cl is not effectively improved, further indicating that the spectral characteristics of potassium K and chloride Cl are weak, and different modeling strategies have limited impact on them.
[0135] The above analysis shows that FD preprocessing combined with unified modeling can improve modeling efficiency while ensuring prediction accuracy, providing reliable support for subsequent tobacco quality assessment. Therefore, this embodiment selects the first derivative preprocessing method (FD) as the standard preprocessing method to preprocess the region of interest.
[0136] Furthermore, hyperspectral data contains a large amount of continuous wavelength information, some of which may contain redundancy or noise, affecting the computational efficiency and prediction accuracy of the model. Therefore, this embodiment employs a feature wavelength extraction method to reduce the dimensionality of the data, thereby reducing redundant information and improving the robustness of the model. Principal Component Analysis (PCA) is selected as the feature extraction method. This method projects high-dimensional spectral data onto a smaller number of principal components through linear transformation, thus retaining most of the spectral information while reducing the data dimensionality, effectively removing redundant wavelengths and improving computational efficiency.
[0137] Step 3: Input the extracted feature vector into the hyperspectral multi-chemical component prediction model to obtain the determination results of multiple chemical components.
[0138] It should be noted that the hyperspectral multi-chemical composition prediction model needs to be pre-trained. The training steps are as follows:
[0139] Tobacco leaf samples of different production areas, the same variety, and different grades were obtained. Abnormal tobacco leaf samples were removed using Mahalanobis distance, and the valid tobacco leaf samples were divided into training set and test set.
[0140] For example, we obtain first-cured tobacco leaves of the same variety from four production areas in a given year, covering four grades: B2F, C2F, C3F, and C4F. Fifteen leaves of each grade are selected from each production area, totaling 240 leaves. After removing outliers using Mahalanobis distance, 236 leaf samples are retained. These 236 leaf samples are then divided into a training set (216 leaf samples) and a test set (20 leaf samples).
[0141] Then, for each tobacco leaf sample, hyperspectral images were acquired using a hyperspectral imaging system, and the contents of six major chemical components—total alkaloids, reducing sugars, total sugars, total nitrogen, potassium, and chlorine—were determined using industry-standard methods. All experiments were conducted in a constant temperature and humidity laboratory to ensure the accuracy and repeatability of the data. The determination methods for each component were performed according to tobacco industry standards. All determination procedures were strictly followed according to standard operating procedures, with multiple measurements taken for each sample, and the average value was used as the final data.
[0142] For each hyperspectral image, the leaf image is segmented and extracted based on the tobacco leaf extraction method described in Example 1. Multiple preprocessing methods are used to preprocess the leaf region, and principal component analysis is selected to extract features from the preprocessed leaf region.
[0143] A hyperspectral multi-chemical component prediction model is constructed based on a partial least squares regression model. The output of the hyperspectral multi-chemical component prediction model is the content of various chemical components in a tobacco leaf sample, and the input is a feature vector extracted from the leaf image of the hyperspectral image corresponding to the tobacco leaf sample. Specifically, the various chemical components include one or more of total alkaloids, total sugars, reducing sugars, total nitrogen, potassium, and chlorine.
[0144] The hyperspectral multi-chemical composition prediction model was iteratively trained using the training set, and the optimal number of principal components, regression coefficient matrix, and latent variable weight vector were determined through K-fold cross-validation to improve the model's generalization ability and robustness.
[0145] Based on the performance of hyperspectral multi-chemical composition prediction models under different preprocessing methods, the optimal preprocessing method was selected as the standard preprocessing method. It is understood that the model performance evaluation metrics still include the correlation coefficient (R²) and the root mean square error of cross-validation (RMSECV).
[0146] The hyperspectral multi-chemical composition prediction model trained based on the optimal preprocessing method was tested using a test set.
[0147] It is understood that this embodiment establishes a unified model based on FD preprocessing + Principal Component Analysis (PCA) dimensionality reduction + Partial Least Squares Regression (PLSR) + K-fold cross-validation to improve the stability and computational efficiency of the modeling. Through K-fold cross-validation, nine principal components (PCs) were selected as the optimal number of principal components, thereby ensuring the full utilization of spectral information while guaranteeing the accuracy and generalization ability of the model.
[0148] Furthermore, to further verify the model's actual predictive ability, external validation methods were employed for evaluation. Under identical experimental conditions, the test set was measured using both industry-standard methods and the hyperspectral prediction model, and the relative deviation (RD) and relative standard deviation (RSD) were calculated. By comparing the differences between the model's predicted values and the chemically determined values, the effectiveness of different data preprocessing methods and modeling strategies was evaluated, and the optimal approach was selected for subsequent analysis.
[0149] (4)
[0150] (5)
[0151] This embodiment uses a test set consisting of 20 sets of data that were not involved in modeling for external validation. Table 3 lists the regression performance evaluation metrics:
[0152] Table 3 Evaluation Indicators of Model Regression Performance
[0153]
[0154] The data in the table show that the prediction models NIC, TS, RS, and TKn exhibit excellent regression performance, with external validation R² all greater than 0.89. Furthermore, their corresponding mean RD and RSD levels are low, demonstrating good model stability and high prediction accuracy. In contrast, the prediction performance of K and CL is significantly lower, especially CL, which shows a high RSD, reflecting its large data volatility and insufficient model stability. Analysis suggests this may be attributed to the weak characteristic absorption of K and CL in the spectrum, as well as uneven data distribution or feature redundancy among samples, increasing the difficulty of modeling.
[0155] Furthermore, this embodiment further plots scatter plots of the predicted and actual chemical composition values on the training and test sets, see [link to example]. Figure 6These scatter plots illustrate the relationship between the predicted and actual values of the six chemical components. The results show that the scatter plots on the training set demonstrate a high degree of agreement between the predicted and actual values, with the point distribution closely resembling an ideal 1:1 diagonal, indicating strong predictive ability of the model on the training set. The scatter plots on the test set, however, demonstrate the model's generalization ability on data not involved in the modeling process, with results similar to those on the training set, further validating the model's stability and generalization ability.
[0156] Overall, the unified modeling strategy not only maintained high prediction accuracy but also significantly improved computational efficiency and model stability. The use of the FD preprocessing method effectively removed noise and enhanced the expressive power of spectral features. The model demonstrated good predictive performance for the main chemical components of tobacco leaves, providing reliable support for subsequent tobacco quality assessment.
[0157] Furthermore, after obtaining the chemical composition of the tobacco leaf surface, this embodiment further generates an inversion image. Specifically, as follows... Figure 7 As shown.
[0158] In particular, to reduce the impact of outliers on the inversion results, this embodiment also uses the "3σ criterion" (mean ± 3 times standard deviation) as the threshold for data filtering and removes data points that exceed this range. After outlier filtering, the generated chemical composition inversion image shows the distribution of various chemical components on the surface of the tobacco leaf, and the results are clearer.
[0159] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0160] Example 3
[0161] Based on the same inventive concept, this application also provides a tobacco leaf segmentation and extraction device for implementing the tobacco leaf extraction method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more embodiments of the tobacco leaf segmentation and extraction device provided below can be found in the limitations of the tobacco leaf extraction method described above, and will not be repeated here.
[0162] Specifically, the tobacco leaf segmentation and extraction device includes:
[0163] The image acquisition module is used to acquire hyperspectral images of tobacco leaves;
[0164] The threshold segmentation module is used to coarsely extract the main tobacco leaf region from the hyperspectral image using a mask method that combines single-band thresholding and reflectance difference fusion.
[0165] The linear iterative clustering segmentation module is used to improve the linear iterative clustering method to perform fine segmentation of the coarsely extracted tobacco leaf main body region to obtain the leaf region.
[0166] Example 4
[0167] Based on the same inventive concept, this application also provides a non-destructive testing device for tobacco chemical components to implement the aforementioned non-destructive testing method. The solution provided by this device is similar to the solution described in Embodiment 2. Therefore, the specific limitations in one or more embodiments of the non-destructive testing device for tobacco chemical components provided below can be found in the limitations of the non-destructive testing method for tobacco chemical components described above, and will not be repeated here.
[0168] The hyperspectral-based non-destructive testing device for tobacco chemical components includes:
[0169] The region of interest extraction module is used to acquire the hyperspectral image of the tobacco leaf sample to be measured. Based on the tobacco leaf extraction method described in Example 1, the region of interest is extracted from the hyperspectral image of the tobacco leaf sample to be measured to obtain the leaf region.
[0170] The preprocessing module is used to preprocess the blade region based on standard preprocessing methods;
[0171] The feature extraction module is used to extract features from the preprocessed leaf region using principal component analysis.
[0172] The measurement result acquisition module is used to identify feature vectors using a hyperspectral prediction model constructed based on a partial least squares regression model, thereby obtaining measurement results for various chemical components. The steps for constructing the hyperspectral prediction model based on the partial least squares regression model are described in Example 2.
[0173] It is understood that the region of interest extraction module can also be the tobacco leaf segmentation and extraction device described in Example 3.
[0174] Example 5
[0175] This embodiment describes a computer device, which may be a terminal, and its internal structure diagram may be as follows. Figure 8As shown. The computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements the tobacco leaf extraction method described in Example 1 or the non-destructive determination method for the chemical components of tobacco leaves described in Example 2. The display unit of the computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0176] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0177] Example 6
[0178] Based on the above embodiments, this embodiment provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the tobacco leaf extraction method as described in Embodiment 1 or the non-destructive determination method of tobacco chemical components as described in Embodiment 2.
[0179] Example 7
[0180] Based on the above embodiments, this embodiment provides a computer program product, including a computer program that, when executed by a processor, implements the tobacco leaf extraction method as described in Embodiment 1 or the non-destructive determination method of tobacco chemical components as described in Embodiment 2.
[0181] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0182] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0183] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
[0184] 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; although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications can still be made to the specific implementation of the present invention or equivalent substitutions can be made to some technical features without departing from the spirit of the technical solutions of the present invention, and all such modifications and substitutions should be covered within the scope of the technical solutions claimed in the present invention.
Claims
1. A method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering, characterized in that, Includes the following steps: Hyperspectral images of tobacco leaves were acquired, and a masking method combining single-band thresholding and reflectance difference fusion was used to coarsely extract the main tobacco leaf region from the hyperspectral images. An improved linear iterative clustering method was used to finely segment the main tobacco leaf region extracted from the coarse data, thereby obtaining the leaf region.
2. The method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering according to claim 1, characterized in that, A masking method using single-band thresholding and reflectance difference fusion is employed to coarsely extract the main tobacco leaf region from hyperspectral images, including the following steps: The reflectance value of a specific band is used as a mask threshold to perform masking processing on the hyperspectral image to obtain the foreground region; The difference between the maximum and minimum reflectance of each pixel in the foreground region within a specific wavelength range is calculated, and the reflectance differences of each pixel are sorted by size. The reflectance difference with the highest value in the sorted range is selected as the dynamic threshold to perform thresholding on the foreground region, generating a mask image with a non-uniform structure. Based on the mask image with a non-uniform structure, the foreground region is processed to remove the non-uniform structure and obtain the main tobacco leaf region.
3. A method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering according to claim 1 or 2, characterized in that, An improved linear iterative clustering method was used to refine the coarsely extracted tobacco leaf body region, resulting in leaf regions including: The main tobacco leaf region is divided into superpixel regions of uniform size. The center point of each superpixel region is selected as the initial cluster center. It is determined whether the initial cluster center is located within the main tobacco leaf region. If not, a new initial cluster center is searched within its neighborhood until it is located within the main tobacco leaf region. Clustering is performed within a preset search range of the initial cluster centers. The distance between each pixel and all its neighboring cluster centers within the preset search range is calculated based on spectral cosine similarity and spatial distance. The cluster center closest to each pixel is selected and the pixel is assigned to the cluster center closest to it. After one round of iteration, the cluster centers are recalculated based on the current superpixel partition. Repeat the previous step until the position of the cluster center no longer changes significantly. Then, post-process the obtained superpixel region to obtain the leaf region.
4. The method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering according to claim 3, characterized in that, After filtering out the cluster center closest to each pixel, it is further determined whether the distance between each pixel and its nearest cluster center meets the high distance threshold for abnormal pixels. If it does, the pixel is marked as an abnormal point; otherwise, the pixel is classified into the same category as its nearest cluster center.
5. The method for extracting tobacco leaf samples based on threshold masking and linear iterative clustering according to claim 3, characterized in that, When post-processing the obtained superpixel regions, it is determined whether the area of each superpixel region is less than a set area threshold. If it is less than the set area threshold, it is further determined whether the difference in spectral characteristics between the superpixel region and the adjacent superpixel regions exceeds a preset difference range. If the difference in spectral features is greater than the similarity range, the superpixel region is identified as an abnormal region and removed. In response to the spectral feature difference being within the similarity range, the superpixel region is merged into the neighboring superpixel region with the most similar spectral features, where the similarity range is smaller than the anomaly range; In response to a spectral feature difference less than the similarity range, the superpixel region is marked as background and removed. The spectral feature difference is calculated based on the mean feature vector of the two superpixel regions in the multi-band spectral data.
6. A non-destructive method for determining the chemical components of tobacco leaves based on hyperspectral imaging, characterized in that, Includes the following steps: Acquire a hyperspectral image of the tobacco leaf sample to be tested, and extract the region of interest from the hyperspectral image based on the tobacco leaf extraction method according to any one of claims 1-5 to obtain the leaf region; The leaf region was preprocessed using standard preprocessing methods, and principal component analysis was used to extract features from the preprocessed leaf region. The extracted feature vectors are input into the hyperspectral multi-chemical component prediction model to obtain the determination results of various chemical components.
7. The non-destructive method for determining the chemical components of tobacco leaves based on hyperspectral imaging according to claim 6, characterized in that, The steps for obtaining a hyperspectral multi-chemical composition prediction model include: Hyperspectral images and multiple chemical composition data of tobacco leaf samples from different production areas, of the same variety, and of different grades were obtained. Abnormal hyperspectral images were removed using Mahalanobis distance, and the effective hyperspectral images were divided into training and testing sets. For each hyperspectral image, the leaf image is segmented and extracted based on the tobacco leaf extraction method according to any one of claims 1-5. Multiple preprocessing methods are used to preprocess the leaf region, and principal component analysis is selected to extract features from the preprocessed leaf region. A hyperspectral multi-chemical component prediction model is constructed based on a partial least squares regression model. The output of the hyperspectral multi-chemical component prediction model is the content of various chemical components in a tobacco leaf sample, and the input is a feature vector extracted from the leaf image of the hyperspectral image corresponding to the tobacco leaf sample. The hyperspectral multi-chemical composition prediction model was iteratively trained using the training set, and the optimal number of principal components, regression coefficient matrix and latent variable weight vector were determined by K-fold cross-validation. Based on the performance of the hyperspectral multi-chemical composition prediction model under different preprocessing methods, the optimal preprocessing method was selected as the standard preprocessing method. The hyperspectral multi-chemical composition prediction model trained based on the optimal preprocessing method was tested using a test set.
8. The non-destructive method for determining the chemical components of tobacco leaves based on hyperspectral imaging according to claim 7, characterized in that, The various chemical components include one or more of total alkaloids, total sugars, reducing sugars, total nitrogen, potassium, and chlorine.
9. A non-destructive method for determining the chemical components of tobacco leaves based on hyperspectral imaging according to claim 6, 7, or 8, characterized in that, After obtaining the chemical composition determination results, a chemical composition inversion image is generated based on the chemical composition determination results.
10. A tobacco leaf segmentation and extraction device based on threshold masking and linear iterative clustering, characterized in that, include: The image acquisition module is used to acquire hyperspectral images of tobacco leaves; The threshold segmentation module is used to coarsely extract the main tobacco leaf region from the hyperspectral image using a mask method that combines single-band thresholding and reflectance difference fusion. The linear iterative clustering segmentation module is used to improve the linear iterative clustering method to perform fine segmentation of the coarsely extracted tobacco leaf main body region to obtain the leaf region.
11. A non-destructive device for determining the chemical components of tobacco leaves based on hyperspectral imaging, characterized in that, include: The region of interest extraction module is used to extract the region of interest from the hyperspectral image of the tobacco leaf sample to be measured based on the tobacco leaf extraction method according to any one of claims 1-5, so as to obtain the leaf region. The preprocessing module is used to preprocess the blade region based on standard preprocessing methods; The feature extraction module is used to extract features from the preprocessed leaf region using principal component analysis. The measurement result acquisition module is used to identify feature vectors by a hyperspectral prediction model built based on a partial least squares regression model, and obtain measurement results of various chemical components.
12. A computer device, characterized in that: It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor, when executing a program stored in a memory, implements the steps of the tobacco leaf extraction method according to any one of claims 1 to 5, or the steps of the non-destructive determination method of tobacco chemical components according to claims 6 to 9.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the tobacco leaf extraction method according to any one of claims 1 to 5, or the steps of the non-destructive determination method of tobacco chemical components according to claims 6 to 9.
14. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the tobacco leaf extraction method according to any one of claims 1 to 5, or the steps of the non-destructive determination method of tobacco chemical components according to claims 6 to 9.