Tobacco shred volume detection method, device, equipment and medium
Through the integration of multi-view image processing and sensor data, the accuracy and convenience of tobacco volume detection are solved, and efficient and accurate measurement of tobacco volume is achieved.
Patent Information
- Application Number
- CN202510424906.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-22
AI Technical Summary
In the prior art, the accuracy and convenience of tobacco volume detection are poor, the manual detection is labor-intensive and the error is large, and the detection method based on image recognition is sensitive to image quality, resulting in inaccurate detection results.
By acquiring the tobacco images of multiple perspectives, performing binarization and preprocessing, using an adaptive threshold algorithm and volume detection model for detection, combining multi-sensor data fusion, and adjusting the weights using the Kalman filtering algorithm to obtain the target volume data.
It improves the accuracy and reliability of tobacco volume detection, adapts to changes in different batches of tobacco, reduces measurement errors caused by color and texture differences, and provides more tobacco characteristic information.
Smart Images

Figure CN120355774A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to the fields of cut tobacco detection technology and cut tobacco quality detection technology, and particularly to a method, device, equipment and medium for detecting the volume of cut tobacco. Background Art
[0002] Currently, the methods for detecting the volume of cut tobacco in related technologies are mostly manual detection or detection methods based on image recognition.
[0003] However, the manual detection method has a large labor intensity, a long sampling period, poor evaluation objectivity, a low accuracy of cut tobacco detection, and particularly a large error in detecting the volume of cut tobacco. The detection method based on image recognition is very sensitive to the image quality, and poor image quality may lead to inaccurate detection results.
[0004] Therefore, how to accurately and conveniently detect the volume of cut tobacco is an urgent problem to be solved. Summary of the Invention
[0005] This application provides a method, device, equipment and medium for detecting the volume of cut tobacco, which can solve the problem of poor accuracy and convenience in detecting the volume of cut tobacco. The technical solutions are as follows:
[0006] In a first aspect, a method for detecting the volume of cut tobacco is provided. The method includes:
[0007] Obtain multi-view cut tobacco images to be processed;
[0008] Perform binarization processing on the cut tobacco images to obtain first volume data corresponding to the binarized images;
[0009] Use a preset volume detection model to perform detection processing on the cut tobacco images to obtain second volume data;
[0010] Perform fusion processing on the first volume data and the second volume data to obtain target volume data.
[0011] In a possible implementation manner, performing binarization processing on the cut tobacco images to obtain first volume data corresponding to the binarized images includes:
[0012] Preprocess the cut tobacco images to obtain preprocessed cut tobacco images;
[0013] Use a preset adaptive threshold algorithm to perform binarization processing on the preprocessed cut tobacco images to obtain first volume data corresponding to the binarized images.
[0014] In a possible implementation, the binary processing of the preprocessed cut tobacco image by using a preset adaptive threshold algorithm to obtain first volume data corresponding to the binary image includes:
[0015] Based on each pixel point in the preprocessed cut tobacco image, using the preset adaptive threshold algorithm to determine the local window threshold corresponding to each pixel point of the preprocessed cut tobacco image;
[0016] Based on each pixel point in the preprocessed cut tobacco image, the local window threshold, and a preset evaluation index, obtain a binary image;
[0017] Perform three-dimensional reconstruction on the binary image, and calculate the circumscribed rectangle sizes of each connected region in the binary image;
[0018] Based on the circumscribed rectangle sizes of each connected region in the binary image, obtain the first volume data corresponding to the binary image.
[0019] In a possible implementation, the detection processing of the cut tobacco image by using a preset volume detection model to obtain second volume data includes:
[0020] Perform data enhancement processing on the cut tobacco image to obtain a cut tobacco image after data enhancement processing;
[0021] Input the cut tobacco image after data enhancement processing into the preset volume detection model, and output a detection result;
[0022] Based on the detection result, obtain the second volume data.
[0023] In a possible implementation, the fusion processing of the first volume data and the second volume data to obtain target volume data;
[0024] Obtain the cut tobacco detection results of multiple sensors;
[0025] Use a preset fusion algorithm to perform fusion processing on the first volume data and the second volume data to obtain a result of fusion processing;
[0026] Use the Kalman filtering algorithm to determine the weight values of the cut tobacco detection results of each sensor;
[0027] Based on the cut tobacco detection results of each sensor and the corresponding weight values, respectively perform adjustment processing on the result of fusion processing to obtain target volume data.
[0028] In a second aspect, a device for detecting the volume of cut tobacco is provided, and the device includes:
[0029] An acquisition unit for acquiring multi-view cut tobacco images to be processed;
[0030] A processing unit for binarizing the cut tobacco image to obtain first volume data corresponding to the binarized image;
[0031] A detection unit for performing detection processing on the cut tobacco image by using a preset volume detection model to obtain second volume data;
[0032] An obtaining unit for fusing the first volume data and the second volume data to obtain target volume data.
[0033] In a third aspect, a computer-readable storage medium is provided. At least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the methods in the above-mentioned aspect and any possible implementation manners.
[0034] In a fourth aspect, an electronic device is provided, including:
[0035] At least one processor; and
[0036] A memory communicatively connected to the at least one processor; wherein,
[0037] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the methods in the above-mentioned aspect and any possible implementation manners.
[0038] In a fifth aspect, a computer program product is provided, including a computer program which, when executed by a processor, implements the methods in the above-mentioned aspect and any possible implementation manners.
[0039] In a sixth aspect, a device for detecting the volume of cut tobacco is provided. The device includes: a light source module, an image capture module, and the electronic device as described above.
[0040] The beneficial effects of the technical solution provided in this application at least include:
[0041] As can be seen from the above technical solution, the embodiment of the present application can obtain multi-view tobacco cut filler images to be processed, and then perform binarization processing on the tobacco cut filler images to obtain the first volume data corresponding to the binarized images. Using a preset volume detection model, the tobacco cut filler images are detected to obtain the second volume data, and the first volume data and the second volume data are fused to obtain the target volume data. Since the tobacco cut filler images can be binarized, it can adapt to the changes in different batches of tobacco cut filler, reduce the measurement errors caused by the differences in the color and texture of the tobacco cut filler, and combine the detection results of the tobacco cut filler images by the preset volume detection model to obtain the target volume data of the tobacco cut filler, which can directly extract more complex features from the original images, provide more information about the features of the tobacco cut filler, improve the accuracy of image detection, and thus improve the accuracy of tobacco cut filler volume measurement.
[0042] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become easily understood through the following description. Brief Description of the Drawings
[0043] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0044] Figure 1 is a flowchart of a method for detecting the volume of tobacco cut filler provided by an embodiment of the present application;
[0045] Figure 2 is a structural block diagram of a device for detecting the volume of tobacco cut filler provided by another embodiment of the present application;
[0046] Figure 3 is a structural block diagram of a device for detecting the volume of tobacco cut filler provided by another embodiment of the present application;
[0047] Figure 4 is a structural schematic diagram of an image capture module provided by another embodiment of the present application. Detailed Embodiments
[0048] The exemplary embodiments of the present application will be described below in conjunction with the accompanying drawings. Various details of the embodiments of the present application are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.
[0049] Obviously, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts fall within the scope of protection of the present application.
[0050] It should be noted that the terminal devices involved in the embodiments of the present application may include, but are not limited to, intelligent devices such as mobile phones, personal digital assistants (PDAs), wireless handheld devices, and tablet computers (Tablet Computers); display devices may include, but are not limited to, devices with display functions such as personal computers and televisions.
[0051] In addition, the term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after.
[0052] Traditional methods for measuring the volume of cut tobacco are mostly manual measurements, with high labor intensity, long sampling periods, poor evaluation objectivity, low accuracy in cut tobacco detection, and particularly large errors in cut tobacco volume detection. The method for cut tobacco detection based on image recognition is very sensitive to image quality (such as lighting conditions, cut tobacco arrangement methods, etc.). Poor image quality may lead to inaccurate detection results. Moreover, using a fixed area threshold to distinguish and eliminate small connected regions may not be flexible enough because cut tobacco of different batches or different varieties may have different characteristics, and some important details of cut tobacco, such as color and texture, may be lost, which may lead to inaccurate measurement of cut tobacco length and volume.
[0053] Therefore, there is an urgent need to provide a method for detecting the volume of cut tobacco that can effectively detect the length and volume of cut tobacco and ensure the accuracy and reliability of the detection results.
[0054] Please refer to Figure 1 , which shows a schematic flowchart of a method for detecting the volume of cut tobacco provided by an embodiment of the present application. The method for detecting the volume of cut tobacco may specifically include:
[0055] Step 101: Obtain multi-view tobacco shred images to be processed.
[0056] Step 102: Perform binarization processing on the tobacco shred images to obtain first volume data corresponding to the binarized images.
[0057] Step 103: Use a preset volume detection model to perform detection processing on the tobacco shred images to obtain second volume data.
[0058] Step 104: Perform fusion processing on the first volume data and the second volume data to obtain target volume data.
[0059] It should be noted that the multi-view tobacco shred images can be obtained through the image capture module of a tobacco shred volume measurement device.
[0060] It should be noted that the preset volume detection model can be a model based on a convolutional neural network.
[0061] In this way, by performing binarization processing on the tobacco shred images, it can adapt to the changes in different batches of tobacco shreds, reduce measurement errors caused by differences in tobacco shred color and texture, and combine the detection results of the tobacco shred images by the preset volume detection model to obtain the target volume data of the tobacco shreds. More complex features can be directly extracted from the original images, providing more information about the characteristics of the tobacco shreds, solving the problems in the related technology that are very sensitive to image quality, poor image quality may lead to inaccurate detection results, and using a fixed area threshold to distinguish and remove small connected regions may not be flexible enough. Different batches or varieties of tobacco shreds may have different characteristics. At the same time, binarization processing may lose some important details of the tobacco shreds, which may lead to inaccurate length and volume measurements. The accuracy of image detection is improved, thereby improving the accuracy of tobacco shred volume measurement.
[0062] Optionally, in a possible implementation manner of this embodiment, in step 102, the tobacco shred images can be preprocessed to obtain preprocessed tobacco shred images. Secondly, a preset adaptive threshold algorithm can be used to perform binarization processing on the preprocessed tobacco shred images to obtain first volume data corresponding to the binarized images.
[0063] In a specific implementation process of this implementation manner, first, color space conversion processing can be performed on the tobacco shred images to obtain preprocessed tobacco shred images.
[0064] Here, an RGB color image can be converted into a color space more suitable for image segmentation, such as the HSV or Lab space. In these spaces, color variations are easier to distinguish, and the local window size can be better optimized. For example, in the HSV space, the local window size can be adjusted according to the hue of the cut tobacco, because different batches of cut tobacco may vary in hue, thus better adapting to the characteristics of the cut tobacco.
[0065] Exemplarily, the color cut tobacco image is converted into a gray cut tobacco image to obtain the preprocessed cut tobacco image.
[0066] In another specific implementation process of this implementation manner, first, based on each pixel point in the preprocessed cut tobacco image, using a preset adaptive threshold algorithm, the local window threshold corresponding to each pixel point of the preprocessed cut tobacco image can be determined. Secondly, based on each pixel point in the preprocessed cut tobacco image, the local window threshold, and a preset evaluation index, a binary image can be obtained. Thirdly, three-dimensional reconstruction can be performed on the binary image to calculate the circumscribed rectangle sizes of the connected regions in the binary image. Thirdly, based on the circumscribed rectangle sizes of the connected regions in the binary image, the first volume data corresponding to the binary image can be obtained.
[0067] In this implementation manner, the preset adaptive threshold algorithms can include Otsu's Method, Niblack's Method, and Sauvola's Method.
[0068] Here, Otsu's Method is an adaptive threshold binary segmentation method based on the image gray histogram. Specifically, the histogram of the image can be calculated; all possible thresholds are searched, and the between-class variance is calculated; the threshold that maximizes the between-class variance is selected as the segmentation threshold.
[0069] Niblack's Method is a local threshold algorithm that dynamically adjusts the threshold by calculating the mean and standard deviation of the pixel neighborhood and is suitable for images with uneven illumination. Calculate the local mean and standard deviation of the image; threshold = local mean - k * local standard deviation, where k is a user-defined constant, usually 0.2.
[0070] It can be understood that the parameter k value in the Niblack method directly affects the threshold calculation, and the k value can be dynamically adjusted according to the density of the cut tobacco. For the cut tobacco area with a larger density, the k value can be appropriately reduced to make the threshold more sensitive to identify fine cut tobacco structures; for the sparse cut tobacco area, the k value can be appropriately increased to reduce the sensitivity of the threshold and avoid over-segmentation.
[0071] The threshold of Sauvola's Method is calculated as follows: calculate the local mean and standard deviation of the image; threshold = local mean * (1 + k * ((standard deviation / R) - 1)), where R is the maximum standard deviation and k is a constant.
[0072] In another specific implementation process of this implementation manner, first, an adaptive threshold algorithm can be based on to determine the local window size. Second, based on the local window size, calculate the threshold within the local window for each pixel point in the cut tobacco image, and compare each pixel with its corresponding local threshold. Third, use morphological operations to process each pixel point in the cut tobacco image to remove noise, fill small holes, and connect disconnected regions. Third, verify the binarization effect through quantitative analysis.
[0073] One situation of this specific implementation process is that when verifying the binarization effect through quantitative analysis, first, evaluation metrics can be defined. Second, images with known correct binarization results can be collected as a benchmark. Third, the binarized image can be compared with the benchmark image at the pixel level. If the pixel value is greater than the threshold, it is set to white (255), otherwise, it is set to black (0). Calculate the above metrics, and use a confusion matrix to calculate true positives, false positives, true negatives, and false negatives. Third, calculate statistical metrics such as the mean and standard deviation to reflect the stability of the binarization effect, and use an ROC curve to visualize the evaluation results. When the stability of the binarization effect is achieved, the final binarized image can be obtained.
[0074] Here, the evaluation metrics can include precision, recall, accuracy, F1-Score, and intersection over union. Among them, precision can refer to the proportion of correctly binarized pixels among all pixels predicted as target pixels. Recall can refer to the proportion of correctly binarized pixels among all true target pixels. F1-Score can refer to the harmonic mean of precision and recall, which is used to balance the two. Accuracy can refer to the overall prediction accuracy rate, including background and target pixels. Intersection over union can be used to evaluate the segmentation effect.
[0075] It can be understood that by adopting an adaptive threshold method for binarization processing instead of a fixed threshold, it can adapt to the changes of different batches of cut tobacco and reduce measurement errors caused by differences in cut tobacco color and texture. At the same time, enhance the image quality by adjusting brightness, contrast, and sharpening processing, and use a filter to remove noise in the image.
[0076] Optionally, in a possible implementation manner of this embodiment, in step 103, the cut tobacco image can be subjected to data augmentation processing to obtain a cut tobacco image after data augmentation processing, input the cut tobacco image after data augmentation processing into the preset volume detection model, output a detection result, and based on the detection result, obtain the second volume data.
[0077] In a specific implementation process of this implementation manner, the data augmentation process may include affine transformation processing. The cut tobacco image is subjected to affine transformation processing to obtain a cut tobacco image after data augmentation processing.
[0078] In this implementation manner, the affine transformation includes rotation, scaling, distortion, and flipping. In this way, the bending and overlapping of the cut tobacco can be simulated to increase the robustness of the model.
[0079] In a specific implementation process of this implementation manner, the preset volume detection model may be pre-trained based on sample data. The sample data may include cut tobacco image data of different batches, varieties, and quality states, and the sample data set is expanded by methods such as rotation, scaling, and flipping. The network architecture of the volume detection model to be trained may be a convolutional layer, an activation function, a pooling layer, a fully connected layer, and an output layer. The sample data is input into the volume detection model to be trained, the prediction result is calculated, the prediction result is compared with the true label, the loss is calculated, the gradient is calculated through backpropagation, and the network weights are updated until the volume detection model to be trained meets the termination condition, and a trained volume detection model is obtained.
[0080] It can be understood that during the training process, the convolutional layer automatically learns to extract useful features. By visualizing the feature maps, the features extracted by the network at different layers can be intuitively understood, and the performance of the model can be evaluated using the validation set to avoid overfitting.
[0081] In this implementation manner, the preset volume detection model may be a convolutional neural network model based on an attention mechanism and a multi-output network.
[0082] It can be understood that by using the attention mechanism to process the cut tobacco overlapping problem, the attention of the model to key features can be improved. Moreover, based on the multi-output network of multi-task learning, the cut tobacco volume and foreign object detection can be predicted simultaneously. Here, MobileNetV2 can be used as the basic architecture, combined with a lightweight attention module, which is suitable for real-time inference on edge devices.
[0083] It should be noted that the specific implementation process provided in this implementation manner can be combined with the multiple specific implementation processes provided in the foregoing implementation manner to implement the method for detecting the cut tobacco volume in this embodiment. For a detailed description, reference can be made to the relevant content in the foregoing implementation manner, which will not be elaborated here.
[0084] Optionally, in a possible implementation manner of this embodiment, in step 104, first, the tobacco strand detection results of multiple sensors can be obtained. Secondly, the first volume data and the second volume data are fused using a preset fusion algorithm to obtain the result of the fusion process. Thirdly, the Kalman filtering algorithm is used to determine the weight values of the tobacco strand detection results of each sensor. Thirdly, based on the tobacco strand detection results of each sensor and the corresponding weight values, the result of the fusion process is adjusted respectively to obtain the target volume data.
[0085] In this implementation manner, the sensors can include infrared sensors and ultrasonic sensors.
[0086] Here, the preset data fusion algorithms can include the weighted average algorithm, the voting mechanism algorithm, and the model integration algorithm.
[0087] In a specific implementation process of this implementation manner, the first volume data and the second volume data are fused using the weighted average algorithm to obtain the result of the fusion process.
[0088] In another specific implementation process of this implementation manner, the Kalman filtering algorithm is used to determine the weight value of the tobacco strand detection result of the infrared sensor and the weight value of the tobacco strand detection result of the ultrasonic sensor. Thirdly, based on the tobacco strand detection result of the infrared sensor and the weight value of the tobacco strand detection result of the infrared sensor, the result of the fusion process is adjusted to obtain the first adjustment result; based on the tobacco strand detection result of the ultrasonic sensor and the weight value of the tobacco strand detection result of the ultrasonic sensor, the result of the fusion process is adjusted to obtain the second adjustment result. Based on the first adjustment result and the second adjustment result, the target volume data is obtained.
[0089] In another specific implementation process of this implementation manner, based on the target volume data, a target volume data chart or a three-dimensional model of the target volume data is generated, and the target volume data chart or the three-dimensional model of the target volume data is displayed through a display page.
[0090] Here, the infrared sensor can detect the humidity of the tobacco strands and adjust the volume expansion coefficient accordingly, while the ultrasonic data is used to verify the boundary integrity of the three-dimensional reconstruction.
[0091] In this way, the Kalman filter is used to fuse the data of different sensors to obtain the data weights of different sensors, and the fusion accuracy is improved through dynamic weight allocation. When there are conflicts in the sensor data, the weights of each sensor can be dynamically adjusted.
[0092] In this way, by combining the detection data of other sensors for tobacco strands, such as infrared and ultrasonic, more information about the quality of tobacco strands is provided to achieve more comprehensive detection.
[0093] It should be noted that the specific implementation process provided in this implementation manner can be combined with various specific implementation processes provided in the foregoing implementation manner to implement the method for detecting the volume of cut tobacco in this embodiment. For a detailed description, reference can be made to the relevant content in the foregoing implementation manner, which will not be elaborated here.
[0094] Optionally, in a possible implementation manner of this embodiment, in step 102, after obtaining the binary image, first, a preset volume detection model can be used to perform detection processing on the binary image to obtain binary image feature information. Secondly, three-dimensional reconstruction can be performed on the binary image feature information to calculate the circumscribed rectangle sizes of each connected region in the binary image. Thirdly, based on the circumscribed rectangle sizes of each connected region in the binary image, the first volume data corresponding to the binary image is obtained. Thirdly, the Kalman filtering algorithm is used to determine the weight values of the cut tobacco detection results of each sensor. Thirdly, based on the cut tobacco detection results of each sensor and the corresponding weight values, the first volume data is respectively adjusted to obtain the target volume data.
[0095] It should be noted that the specific implementation process provided in this implementation manner can be combined with various specific implementation processes provided in the foregoing implementation manner to implement the method for detecting the volume of cut tobacco in this embodiment. For a detailed description, reference can be made to the relevant content in the foregoing implementation manner, which will not be elaborated here.
[0096] Figure 2 The structural block diagram of the device for detecting the volume of cut tobacco provided by an embodiment of the present application is shown as Figure 2 shown. The device 200 for detecting the volume of cut tobacco in this embodiment may include an acquisition unit 201, a processing unit 202, a detection unit 203, and an obtaining unit 204. Among them, the acquisition unit 201 is used to acquire multi-view cut tobacco images to be processed; the processing unit 202 is used to perform binary processing on the cut tobacco images to obtain the first volume data corresponding to the binary images; the detection unit 203 is used to use a preset volume detection model to perform detection processing on the cut tobacco images to obtain the second volume data; the obtaining unit 204 is used to perform fusion processing on the first volume data and the second volume data to obtain the target volume data.
[0097] Optionally, in a possible implementation manner of this embodiment, the processing unit 202 may specifically be used to preprocess the cut tobacco images to obtain the preprocessed cut tobacco images; use a preset adaptive threshold algorithm to perform binary processing on the preprocessed cut tobacco images to obtain the first volume data corresponding to the binary images.
[0098] Optionally, in a possible implementation of this embodiment, the processing unit 202 may specifically be configured to determine a local window threshold corresponding to each pixel point of the preprocessed cut tobacco image based on each pixel point in the preprocessed cut tobacco image by using a preset adaptive threshold algorithm; obtain a binary image based on each pixel point in the preprocessed cut tobacco image, the local window threshold, and a preset evaluation metric; perform three-dimensional reconstruction on the binary image, and calculate the circumscribed rectangle size of each connected region in the binary image; and obtain first volume data corresponding to the binary image based on the circumscribed rectangle sizes of the connected regions in the binary image.
[0099] Optionally, in a possible implementation of this embodiment, the detection unit 203 may specifically be configured to perform data enhancement processing on the cut tobacco image to obtain a cut tobacco image after data enhancement processing; input the cut tobacco image after data enhancement processing into the preset volume detection model, and output a detection result; and obtain the second volume data based on the detection result.
[0100] Optionally, in a possible implementation of this embodiment, the obtaining unit 204 may specifically be configured to obtain cut tobacco detection results of multiple sensors; perform fusion processing on the first volume data and the second volume data by using a preset fusion algorithm to obtain a result of the fusion processing; determine a weight value of the cut tobacco detection result of each sensor by using a Kalman filtering algorithm; and perform adjustment processing on the result of the fusion processing respectively based on the cut tobacco detection result of each sensor and the corresponding weight value to obtain target volume data.
[0101] In this embodiment, a obtaining unit may be used to obtain multi-view cut tobacco images to be processed. Furthermore, the processing unit may perform binary processing on the cut tobacco images to obtain first volume data corresponding to the binary images. The detection unit may use the preset volume detection model to perform detection processing on the cut tobacco images to obtain second volume data. The obtaining unit may perform fusion processing on the first volume data and the second volume data to obtain target volume data. Since binary processing can be performed on the cut tobacco images, it can adapt to the changes in different batches of cut tobacco, reduce measurement errors caused by differences in cut tobacco color and texture, and combine the detection results of the cut tobacco images by using the preset volume detection model to obtain the target volume data of the cut tobacco. More complex features can be directly extracted from the original images, providing more cut tobacco feature information and improving the accuracy of image detection, thereby improving the accuracy of cut tobacco volume measurement.
[0102] Figure 3 The structural block diagram of a device for cut tobacco volume detection provided by an embodiment of the present application is shown as Figure 3As shown. An embodiment of the present application further provides a device for detecting the volume of cut tobacco, and the device includes a light source module, an image capture module, and an electronic device.
[0103] Optionally, the light source module can be an LED lamp. By adjusting the LED light source, uniform, stable, and appropriate illumination is ensured, reducing shadows and reflections.
[0104] Here, the LED light source can adopt a circular array. Using a circular LED array to surround the cut tobacco sample, it can illuminate uniformly from multiple angles, reducing shadows.
[0105] Exemplarily, the ambient light intensity is detected in real time by a light sensor, and the brightness of the LED is automatically adjusted according to the feedback to ensure a consistent illumination effect under different environmental conditions. Pulse Width Modulation (PWM) technology can be used to precisely control the brightness of the LED. A polarizing filter is used to cover the LED light source to reduce specular reflection. The polarizing filter can filter out non-polarized light and retain polarized light, reducing the impact of reflections on the image quality. The LED lamp and the camera can be synchronously triggered using an external trigger signal. Hardware connection is used to ensure that the LED and the camera start at the same moment, avoiding the stroboscopic phenomenon. The trigger output signal of the camera can be used to synchronize the lighting of the LED.
[0106] Optionally, Figure 4 The structural schematic diagram of the image capture module provided by an embodiment of the present application is shown, as Figure 4 shown. The image capture module can be a high-resolution industrial camera. The number of cameras is multiple. High-quality images of the cut tobacco can be captured from different angles by multiple cameras.
[0107] Here, the geometric parameters of the camera layout include the baseline distance and the included angle. Baseline distance: The baseline distance between the cameras should be long enough to provide good stereo parallax, but not too long to cause a narrow field of view. Included angle: The included angle between the cameras needs to be optimized to maximize the coverage of the field of view of the cut tobacco sample while ensuring the accuracy of parallax calculation.
[0108] Here, for the multi-view image registration algorithm of the camera, a calibration board is used to pre-calibrate the camera position to obtain the internal and external parameters of the camera; during image registration, the Scale-Invariant Feature Transform (SIFT) algorithm can be used for feature point matching, and then the Random Sample Consensus (RANSAC) algorithm is used to remove mismatched points to achieve sub-pixel alignment and obtain cut tobacco images from multiple angles.
[0109] Optionally, the electronic device can be used to execute the above-mentioned cut tobacco volume detection method.
[0110] It should be noted that for the foregoing embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0111] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0112] In the technical solution of this application, the collection, storage, use, processing, transmission, provision, and disclosure, etc. of the user's personal information involved, such as the user's image and attribute data, etc., all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0113] According to the embodiments of this application, this application also provides a readable storage medium and a computer program product.
[0114] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk, an optical disk, etc.
[0115] It should be understood that various forms of the processes shown above can be used, reordering, adding, or deleting steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solution disclosed in this application can be achieved. This is not limited herein.
[0116] The above specific implementation manners do not constitute a limitation to the protection scope of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the protection scope of this application.
Claims
1. A method for detecting the volume of cut tobacco, characterized in that, The method includes: Obtaining multi - perspective cut tobacco images to be processed; Performing binarization processing on the cut tobacco images to obtain first volume data corresponding to the binarized images; Using a preset volume detection model to perform detection processing on the cut tobacco images to obtain second volume data; Performing fusion processing on the first volume data and the second volume data to obtain target volume data.
2. The method according to claim 1, characterized in that Performing binarization processing on the cut tobacco images to obtain first volume data corresponding to the binarized images, including: Pre - processing the cut tobacco images to obtain pre - processed cut tobacco images; Using a preset adaptive threshold algorithm to perform binarization processing on the pre - processed cut tobacco images to obtain first volume data corresponding to the binarized images.
3. The method according to claim 2, wherein The using a preset adaptive threshold algorithm to perform binarization processing on the pre - processed cut tobacco images to obtain first volume data corresponding to the binarized images includes: Based on each pixel point in the pre - processed cut tobacco images, using a preset adaptive threshold algorithm to determine the local window threshold corresponding to each pixel point in the pre - processed cut tobacco images; Based on each pixel point in the pre - processed cut tobacco images, the local window threshold, and a preset evaluation index, obtaining a binarized image; Performing three - dimensional reconstruction on the binarized image, and calculating the circumscribed rectangle sizes of each connected region in the binary image; Based on the circumscribed rectangle sizes of each connected region in the binary image, obtaining first volume data corresponding to the binarized image.
4. The method according to claim 1, wherein The using a preset volume detection model to perform detection processing on the cut tobacco images to obtain second volume data includes: Performing data enhancement processing on the cut tobacco images to obtain cut tobacco images after data enhancement processing; Inputting the cut tobacco images after data enhancement processing into the preset volume detection model, and outputting a detection result; Based on the detection result, obtaining the second volume data.
5. The method according to claim 1, wherein The performing fusion processing on the first volume data and the second volume data to obtain target volume data includes: Obtaining cut tobacco detection results of multiple sensors; Using a preset fusion algorithm to perform fusion processing on the first volume data and the second volume data to obtain a result of fusion processing; Using a Kalman filtering algorithm to determine the weight values of the cut tobacco detection results of each sensor; Based on the cut tobacco detection results of each sensor and the corresponding weight values, respectively performing adjustment processing on the result of fusion processing to obtain target volume data.
6. A device for detecting the volume of cut tobacco, characterized in that, The device includes: An obtaining unit, configured to obtain multi - perspective cut tobacco images to be processed; A processing unit, configured to perform binarization processing on the cut tobacco images to obtain first volume data corresponding to the binarized images; A detection unit, configured to use a preset volume detection model to perform detection processing on the cut tobacco images to obtain second volume data; An obtaining unit, configured to perform fusion processing on the first volume data and the second volume data to obtain target volume data.
7. An electronic device, characterized in that, Including: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1-5.
8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are for causing the computer to execute the method according to any one of claims 1-5.
9. A computer program product, characterized in that, It includes a computer program which, when executed by a processor, implements the method according to any one of claims 1-5.
10. An apparatus for detecting the volume of cut tobacco, characterized in that, The device includes: a light source module, an image capture module, and the electronic device according to claim 7.