A method for correcting and enhancing the distortion of a cured tobacco leaf image
By using a Poisson equation-based illumination homogenization and Laplacian pyramid image fusion algorithm to dynamically adjust correction parameters, the image quality problems caused by unevenness leading to shadows and optical distortion in the acquisition of cured tobacco leaf images are solved, thus achieving a solution to the technical problems of image quality improvement in cured tobacco leaf images.
Patent Information
- Application Number
- CN202511468292.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2045-10-15
AI Technical Summary
Traditional image acquisition techniques for cured tobacco leaves cannot effectively handle shadows and reflections caused by unevenness in the tobacco leaves, affecting image quality and the accuracy of automated detection.
Distortion segmentation points are identified by an illumination homogenization algorithm based on the Poisson equation. Combined with a Laplacian pyramid image fusion algorithm and dynamic correction parameter adjustment, distortion correction of roasted tobacco leaf images is achieved.
It effectively eliminates the effects of shadows and reflections, improves image quality, and enhances the accuracy and stability of automated detection.
Smart Images

Figure CN120953141B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of flue-cured tobacco, and particularly relates to a flue-cured tobacco leaf image distortion correction enhancement method. BACKGROUND
[0002] In the field of flue-cured tobacco quality detection in the tobacco industry, the traditional image acquisition technology mainly adopts a single light source illumination system with a fixed angle to cooperate with an industrial camera to acquire images, records the surface features of tobacco leaves by setting a standardized shooting distance and exposure parameters, and performs post-processing on the collected images by using basic image enhancement algorithms such as contrast adjustment and sharpening filtering. These methods can obtain a relatively satisfactory imaging effect when processing flat tobacco samples. However, the traditional technology has significant limitations when facing the actual physical state of flue-cured tobacco. Uneven heating and water loss of tobacco leaves during the curing process will cause the leaves to wrinkle, curl and have uneven surfaces. These uneven surfaces will produce complex shadow distribution and local light reflection under fixed light source illumination. The traditional uniform illumination system cannot adapt to such three-dimensional morphological changes, resulting in alternating stripe-shaped distortions and high light overflow areas in the images. In the current tobacco automatic grading system, due to the inability to effectively eliminate the optical interference caused by the uneven surface of tobacco leaves, the color recognition algorithm often misjudges the shadow area as a tobacco defect and misidentifies the light reflection area as a color anomaly, which seriously affects the reliability of quality evaluation. At the same time, these optical distortions also interfere with texture feature extraction and shape measurement, resulting in a significant decrease in the accuracy of the entire automatic detection system. That is, there is a technical problem in the prior art that uneven tobacco causes shadows and light reflections during image acquisition, affecting image quality and subsequent analysis accuracy. SUMMARY
[0003] Therefore, the present application provides a flue-cured tobacco leaf image distortion correction enhancement method, which can solve the technical problem of uneven tobacco causing shadows and light reflections during image acquisition, affecting image quality in the prior art.
[0004] The present application is achieved in that the present application provides a kind of baking tobacco leaf image distortion correction enhancement method, including the acquired baking tobacco leaf image is carried out distortion segmentation point detection, the illumination homogenization algorithm based on Poisson equation is used to calculate image gradient field, and the illumination homogenization distribution is obtained by solving Poisson equation by finite difference method, and the area of illumination variation exceeding illumination threshold is identified and marked as distortion segmentation point;Distortion jump point matrix is constructed based on distortion segmentation point, the gray difference between adjacent distortion segmentation points is statistically analyzed, and when the gray difference exceeds jump threshold, the point is marked as distortion jump point, and distortion jump point matrix is formed;Multi-exposure tobacco leaf image is processed by Laplacian pyramid image fusion algorithm, each input image is decomposed into different scale Laplacian pyramid, fusion rule is designed based on local contrast and gradient amplitude, high-quality fusion image is obtained by reconstruction, and distortion continuous point vector is extracted;Correction error vector is calculated, the fusion image is compared with the original image at pixel level, the color difference value of each area is counted, when the color difference value exceeds error threshold, the error information of corresponding position is recorded, and correction error vector is constructed;Correction correlation matrix is established, the spatial relationship and numerical correlation between distortion segmentation point, distortion jump point and distortion continuous point vector are analyzed, the correlation coefficient between each point is calculated, and correction correlation matrix is formed;According to correction error vector and correction correlation matrix, correction parameter is dynamically adjusted, when the error value in correction error vector exceeds the set error threshold, the illumination homogenization processing intensity is increased, when the correlation coefficient in correction correlation matrix is lower than the standard correlation value, the weight parameter of fusion algorithm is reduced;Correction accuracy vector is calculated, the corrected image is compared with the standard tobacco leaf image, the color uniformity index is counted, when the accuracy value in correction accuracy vector reaches the accuracy range, the correction processing is completed, otherwise, the correction is reprocessed.
[0005] Wherein, the step of distortion segmentation point detection is specifically that the distortion segmentation point refers to the pixel position point in the baking tobacco leaf image caused by color mutation due to uneven illumination or imaging distortion, which is determined by calculating the points with gradient amplitude exceeding the preset illumination threshold in the image gradient field, and the illumination threshold is obtained by calculating the mark variable mark, and the absolute value sum of the red component, green component and blue component difference of the real-time shooting image and the background image is divided by 3 times the image length-width product.
[0006] Wherein, the step of distortion jump point matrix construction is specifically that the distortion jump point matrix is a two-dimensional array structure for recording the significant jump of gray value between adjacent pixels, and the matrix element value is 1, indicating that there is a distortion jump point at the position, and 0 indicates normal, and the jump detection is carried out after calculating the gray value of each pixel by averaging the red component, green component and blue component through the gray processing formula.
[0007] The step of the Laplacian pyramid image fusion algorithm is specifically a one-dimensional array for describing the continuity distribution characteristics of the continuous points of the distortion region in the image, and the continuous distortion feature points at different scales are formed by the Laplacian pyramid image fusion algorithm for extracting, which is used to represent the spatial continuity of the distortion, and each input image is decomposed into a Laplacian pyramid structure at different scales, and feature extraction and fusion processing are performed on each level based on the local contrast and gradient amplitude.
[0008] The step of the correction error vector calculation is specifically a one-dimensional array structure for quantifying the difference between the images before and after correction, and is composed by calculating the color difference values of the original image and the corrected image at each pixel position, wherein the color difference calculation adopts a binary segmentation method for region division, and is marked as 1 when the pixel gray value is greater than the optimal segmentation threshold, and is marked as 0 when the pixel gray value is less than or equal to the optimal segmentation threshold, and the optimal segmentation threshold is obtained by maximizing the inter-class variance.
[0009] The step of the correction correlation matrix establishment is specifically a square matrix for describing the spatial relationship and numerical correlation degree between various distortion point types, and the matrix element value represents the correlation strength between the corresponding distortion types, which is quantified by calculating the inter-class variance.
[0010] The step of the dynamic adjustment of the correction parameter is specifically to adaptively adjust the processing parameter according to the calculation results of the correction error vector and the correction correlation matrix, and when the error value detected in the correction error vector exceeds the preset error threshold, the processing strength of the light uniformization algorithm is automatically increased, and when the correlation coefficient in the correction correlation matrix is lower than the standard correlation threshold, the weight parameter setting of the Laplacian pyramid image fusion algorithm is reduced.
[0011] The step of the correction accuracy vector calculation is specifically a correction accuracy vector for evaluating the correction effect of the distortion, which includes color uniformity, texture fidelity and overall quality score and multiple dimensions, wherein the color uniformity calculation adopts the tobacco leaf image after removing the background, performs normalization processing on the tobacco leaf image after removing the background, and calculates the color uniformity index by counting the pixel distribution characteristics of the tobacco leaf region.
[0012] The accuracy range judgment standard is specifically that when the accuracy value in the correction accuracy vector reaches the range of 85% to 100%, it is determined that the correction processing is completed, and when the accuracy value does not reach the range, the correction error vector calculation step is returned to reiterate the correction until the accuracy index meets the preset requirement, forming a closed-loop correction optimization processing mechanism.
[0013] The optimal speed calculation function of the conveying belt is used to dynamically optimize the running speed of the conveying belt according to the image correction effect and the running parameters of the conveying belt, the input includes a correction accuracy vector, a correction error vector, a correction correlation matrix and a current initial speed of the conveying belt, and the output is the optimal speed of the conveying belt.
[0014] The color uniformity calculation index is specifically obtained by summing all pixel values in the tobacco area and dividing the sum by the area of the tobacco area, the standard deviation of the tobacco area is obtained by squaring the difference between the pixel value and the mean value, dividing the sum by the area of the tobacco area and taking the square root, the number of pixels in the interval is obtained by counting the number of pixel points in the range of mean value minus 3 times standard deviation to mean value plus 3 times standard deviation, and the color uniformity is defined as the ratio of the number of pixels in the interval to the total area of the tobacco area.
[0015] Optionally, the tobacco image acquisition device mainly includes a conveying belt, a camera, a light source, a light-shielding shed and an operation device, wherein the conveying belt is used to carry and transport the cured tobacco leaves, the camera is arranged above the conveying belt to capture the tobacco image in real time, the light source provides stable lighting conditions for the camera, the light-shielding shed is used to shield external light interference, and the operation device processes and analyzes the collected image.
[0016] The light uniformization algorithm based on the Poisson equation is specifically to establish a Poisson equation mathematical model by calculating the gradient field distribution characteristics of the image, to solve the Poisson equation by using the finite difference method, to obtain the ideal uniformization light distribution result, to eliminate the influence of light change on the image quality on the premise of keeping the image gradient information unchanged, and to reconstruct the image effect meeting the uniform illumination condition.
[0017] The multi-exposure tobacco image processing is specifically to obtain multiple images of the same tobacco sample by using different exposure parameters, to convert each input image into a multi-scale frequency domain representation by Laplacian pyramid decomposition, to design corresponding fusion weight rules according to the local contrast and gradient amplitude characteristics at each scale level, and to reconstruct a high-quality fusion image containing rich detail information.
[0018] The pixel-level contrast analysis is specifically to compare the fusion image after correction processing with the original input image one by one at each pixel position, to calculate the color difference value of the corresponding position pixel, to count the color difference distribution in each image area, to record the specific error information of the pixel position when detecting that the color difference value exceeds the preset error threshold, and to construct a complete correction error vector data structure.
[0019] The spatial relationship and numerical correlation analysis is specifically through calculating the spatial distance relationship and numerical similarity relationship between three different distortion characteristic types of distortion segmentation points, distortion jump points and distortion continuous point vectors, establishing a mathematical correlation model describing the mutual influence degree between different distortion types, calculating the correlation coefficient values between distortion points at different positions, and forming a complete correction correlation matrix for guiding the subsequent correction parameter adjustment process.
[0020] The present application can effectively identify and compensate the illumination variation caused by the unevenness of the tobacco leaf surface by establishing an illumination uniformization processing mechanism based on the Poisson equation, and obtain an ideal uniform illumination distribution by calculating the image gradient field and solving the Poisson equation, thereby eliminating the influence of shadows and reflections on the image quality. The present application adopts a multi-level distortion detection system, including distortion segmentation point detection for identifying illumination mutation regions, distortion jump point matrix construction for marking the gray scale jump positions, and distortion continuous point vector extraction for describing continuous distortion characteristics. This hierarchical processing strategy can accurately locate various optical distortions caused by the unevenness of the tobacco leaf surface, provide accurate data support for targeted correction, and realize multi-scale image reconstruction by combining the Laplacian pyramid image fusion algorithm, which can process large-scale illumination variation and maintain detailed features. The present application can adaptively adjust the processing parameters according to the surface morphological characteristics of different tobacco samples by constructing a dynamic correction parameter adjustment mechanism including correction error vector calculation and correction correlation matrix analysis, ensure that high-quality correction results can be obtained when facing various degrees of surface unevenness, and solve the technical problems in the prior art that shadows and reflections are generated during image acquisition due to the unevenness of the tobacco leaf, affecting the image quality and the accuracy of subsequent analysis. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 The flowchart of the method of the present application.
[0022] Figure 2 The schematic diagram of the tobacco image acquisition device in embodiment 2.
[0023] Figure 3 The spatial distribution diagram of the distortion jump points in embodiment 2.
[0024] Figure 4 The curve diagram of the conveyor belt speed optimization in embodiment 2.
[0025] Figure 5 The distribution statistical diagram of the correction error vectors in embodiment 2.
[0026] Figure 6 The effect diagram of the multi-scale Laplacian pyramid reconstruction quality score in embodiment 2.
[0027] Figure 7Reconstructing the weight coefficient map of the multi-scale Laplacian pyramid in Example 2. DETAILED DESCRIPTION
[0028] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.
[0029] As Figure 1 shown is a flowchart of a tobacco leaf image distortion correction enhancement method provided by the present application, and the method comprises the following steps:
[0030] S01, detecting a distortion segmentation point of an acquired tobacco leaf image, calculating an image gradient field by using a light uniformization algorithm based on a Poisson equation, obtaining a uniformized light distribution by solving the Poisson equation through a finite difference method, identifying a region with light variation exceeding a light threshold value and marking it as a distortion segmentation point;
[0031] S02, constructing a distortion jump point matrix based on the distortion segmentation point, statistically analyzing a gray value difference between adjacent distortion segmentation points, marking the points as distortion jump points when the gray value difference exceeds a jump threshold value, and forming a distortion jump point matrix for subsequent correction processing;
[0032] S03, processing multi-exposure tobacco leaf images through a Laplacian pyramid image fusion algorithm, decomposing each input image into a Laplacian pyramid of different scales, designing a fusion rule based on local contrast and gradient amplitude, reconstructing a high-quality fusion image and extracting a distortion continuous point vector;
[0033] S04, calculating a correction error vector, comparing the fusion image with the original image at a pixel level, statistically analyzing a color difference value of each region, recording error information of a corresponding position when the color difference value exceeds an error threshold value, and constructing a correction error vector for evaluating correction effect;
[0034] S05, establishing a correction correlation matrix, analyzing spatial relationships and numerical correlations among the distortion segmentation point, the distortion jump point and the distortion continuous point vector, calculating a correlation coefficient between each point, and forming a correction correlation matrix to guide subsequent correction parameter adjustment;
[0035] S06, dynamically adjusting correction parameters according to the correction error vector and the correction correlation matrix, increasing light uniformization processing intensity when an error value in the correction error vector exceeds a set error threshold value, and reducing a weight parameter of the fusion algorithm when a correlation coefficient in the correction correlation matrix is lower than a standard correlation value;
[0036] S07, calculate a correction accuracy vector, compare the corrected image with the standard tobacco leaf image, and analyze the color uniformity index. When the accuracy value in the correction accuracy vector reaches the accuracy range [85%, 100%], the correction process is completed, otherwise, return to step S04 to re-correct.
[0037] wherein the distortion segmentation point refers to a pixel position point in the cured tobacco leaf image where color mutation is caused by uneven illumination or imaging distortion, which is determined by calculating points in the image gradient field whose gradient amplitude exceeds a preset illumination threshold, and the illumination threshold is obtained by calculating a mark variable, and the mathematical expression is wherein is a real-time photographed image, is a background image, and M and N are the length and width of the obtained image, respectively. The distortion jump point matrix is a two-dimensional array structure recording the existence of significant jumps in the gray values between adjacent pixels, and the matrix element value is 1 indicating that the position exists a distortion jump point, and the value is 0 indicating normal, and the gray processing formula is After calculating the gray values of each pixel, the jump detection is performed, wherein , and are the pixel values of the red component, the green component and the blue component at the position of the image , respectively.
[0038] The distortion continuous point vector is a one-dimensional array describing the continuity distribution characteristics of the distortion region in the image, which is formed by extracting continuous distortion feature points at different scales through the Laplacian pyramid image fusion algorithm, and is used to represent the spatial continuity of the distortion. The correction error vector is a one-dimensional array structure for quantifying the difference between the images before and after correction, which is composed by calculating the color difference values of the original image and the corrected image at each pixel position, wherein the color difference calculation adopts a binary segmentation formula for region division, when the pixel gray value is greater than the optimal segmentation threshold , , when the pixel gray value is less than or equal to the optimal segmentation threshold , , the optimal segmentation threshold is obtained by maximizing the between-class variance.
[0039] The correction correlation matrix is a square matrix describing the spatial relationship and numerical correlation degree between various distortion point types, and the matrix element value represents the correlation strength between the corresponding distortion types, which is quantified by calculating the between-class variance, and the between-class variance calculation formula is wherein is the probability of the pixel being classified as class A, is the probability of the pixel being classified as class B, is the mean value of class A pixels, is the mean value of the class B pixels. The correction accuracy vector is an index array for evaluating the effect of distortion correction, including color uniformity, texture fidelity and overall quality score, etc. The color uniformity calculation uses the tobacco leaf image after removing the background , the tobacco leaf image after removing the background is normalized to obtain .
[0040] The calculation formula of the average value of the tobacco region pixels is , wherein is the area of the tobacco region, and the standard deviation of the tobacco region is , and the number of pixels in the interval is The calculation formula is , wherein , and the color uniformity is defined as .
[0041] It also includes a conveyor optimal speed calculation function for dynamically optimizing the conveyor running speed according to the image correction effect and the conveyor running parameters to improve the quality of tobacco image acquisition. The input includes the correction accuracy vector, the correction error vector, the correction correlation matrix and the current conveyor initial speed, and the output is the optimal speed of the conveyor.
[0042] The tobacco image acquisition device mainly includes a conveyor, a camera, a light source, a light-shield shed and a calculator. The conveyor is used to carry and transport the cured tobacco leaves. The camera is arranged above the conveyor to capture real-time tobacco images. The light source provides stable lighting conditions for the camera. The light-shield shed is used to shield external light interference. The calculator processes and analyzes the collected images.
[0043] The specific implementation of the above steps is described in detail below.
[0044] The specific implementation of step S01 is to detect the distortion segmentation points of the obtained tobacco leaf image based on the light uniformization algorithm of Poisson equation. First, the real-time image and the background image of the cured tobacco leaf are collected by the camera, and the image is preprocessed by using the marker variable calculation method. The method obtains the light threshold value by calculating the sum of the absolute values of the difference between the real-time image and the background image, and then dividing the product of the image length and width by 3. The reference value of the light threshold value is usually set between 0.15 and 0.25. Then, the gradient field of the image is calculated by applying the light uniformization algorithm based on Poisson equation. The algorithm uses the gradient information of the image to construct the Poisson equation, and solves the Poisson equation by the finite difference method to obtain the uniformized light distribution result. The finite difference method in this step is to discretize the continuous Poisson partial differential equation into a linear equation set, so as to realize the numerical calculation of the light distribution. Finally, by comparing the light change amplitude before and after the uniformization processing, the area whose light change exceeds the preset light threshold value is identified and these positions are marked as distortion segmentation points. This process can effectively identify the color mutation positions caused by uneven light or imaging distortion.
[0045] The specific implementation of step S02 is to construct the distortion jump point matrix based on the detected distortion segmentation points. First, the input color tobacco leaf image is grayed, and the RGB three-channel pixel value averaging method is used to convert the color image to a gray image. The method obtains the corresponding gray value by calculating the average value of the red component, green component and blue component of each pixel position. Then, the gray difference between adjacent pixels is statistically analyzed, and when the gray difference exceeds the preset jump threshold value, the position is marked as a distortion jump point. The reference value of the jump threshold value is usually set between 20 and 35. Finally, a two-dimensional distortion jump point matrix is formed, and the element value of 1 in the matrix indicates that there is a distortion jump point at this position, and the element value of 0 indicates that this position is a normal pixel point. This matrix provides spatial positioning information for subsequent correction processing.
[0046] The specific implementation of step S03 is to process the multi-exposure tobacco leaf images and extract the distortion continuous point vector through the Laplacian pyramid image fusion algorithm. First, the tobacco leaf images taken under different exposure parameters are taken as input, and a Gaussian filter is used to perform multi-scale decomposition on each input image to construct a Gaussian pyramid structure. The number of layers of the Gaussian pyramid is usually set to 4 to 6 layers. Then, the Laplacian pyramid is calculated by subtracting the images of adjacent levels, which can preserve the detail information of the image at different scales. Then, based on the local contrast and gradient amplitude, a fusion rule is designed to weight and fuse each layer of the Laplacian pyramid. The fusion weight is dynamically determined according to the local contrast and gradient amplitude of each pixel position. The reference value of the contrast weight is in the range of 0.3 to 0.7, and the reference value of the gradient weight is in the range of 0.2 to 0.5. Finally, a high-quality fused image is obtained through the reconstruction process of the Laplacian pyramid, and the continuous distortion feature points at different scales are extracted during the fusion process to form a one-dimensional distortion continuous point vector describing the continuity distribution characteristics of the distortion region in the image.
[0047] The specific implementation of step S04 is to calculate the correction error vector to evaluate the image correction effect. First, the fused image obtained in step S03 is compared with the original input image at the pixel level. The color difference value between the two images is calculated pixel by pixel to quantify the difference between the images before and after correction. The color difference calculation uses a binary segmentation method to divide the region, and the best segmentation threshold is determined by maximizing the inter-class variance. This method finds the optimal segmentation point by calculating the inter-class variance of the foreground and background pixels. The reference value of the best segmentation threshold is usually between 120 and 140. When the pixel gray value is greater than the best segmentation threshold, the pixel is marked as a foreground region, and when the pixel gray value is less than or equal to the best segmentation threshold, the pixel is marked as a background region. Then, the color difference values of each region are counted, and when the color difference value of a certain region exceeds the preset error threshold, the error information at that position is recorded. The reference value of the error threshold is usually set between 15 and 25. Finally, a one-dimensional correction error vector is constructed, which is used to quantify the effect of the correction process and provide a basis for subsequent parameter adjustment.
[0048] The specific implementation of step S05 is to establish a correction correlation matrix to describe the relationship between various distortion point types. First, analyze the spatial relationship between the distortion segmentation points detected in step S01, the distortion jump points constructed in step S02, and the distortion continuous point vectors extracted in step S03, and determine the degree of correlation between them by calculating the distribution characteristics of different distortion point types in the spatial position. Then, the inter-class variance calculation method is used to quantitatively analyze the numerical correlation between various distortion point types. This method divides different types of distortion points into two classes, calculates the probability distribution and mean difference of the two classes of pixels, and then obtains the inter-class variance value as a measurement index of correlation strength. The calculation of inter-class variance considers the probability of pixels being divided into different categories and the difference between the mean values of each category, which can effectively reflect the correlation degree between different distortion types. Finally, a square matrix form of correction correlation matrix is formed, and the matrix element value represents the correlation strength between the corresponding distortion types. The reference value range of the correlation coefficient is usually between 0.6 and 0.9. This matrix provides guidance information for the subsequent adjustment of correction parameters.
[0049] The specific implementation of step S06 is to dynamically adjust the correction parameters according to the correction error vector and the correction correlation matrix to optimize the correction effect. First, read the error value in the correction error vector calculated in step S04, and automatically increase the intensity of the light uniformization process when the error value exceeds the set error threshold. The adjustment range of the light uniformization intensity is usually set to 10% to 20% of the current value. The increase of the light uniformization processing intensity is realized by modifying the convergence condition and iteration number in the solving process of the Poisson equation, thereby improving the uniformity of the light distribution. At the same time, read the correlation coefficient in the correction correlation matrix established in step S05, and automatically reduce the weight parameter of the Laplacian pyramid fusion algorithm when the correlation coefficient is lower than the standard correlation value. The reference setting of the standard correlation value is between 0.7 and 0.8. The reduction of the fusion algorithm weight parameter is realized by reducing the local contrast weight and gradient amplitude weight, and the weight adjustment range is usually 5% to 15% of the current value. This dynamic adjustment mechanism can adaptively optimize the processing parameters according to the actual correction effect, and improve the accuracy and stability of distortion correction.
[0050] The specific implementation of step S07 is to calculate the correction accuracy vector to evaluate the final distortion correction effect. First, the corrected tobacco leaf image is compared and analyzed with the standard tobacco leaf image, and multiple dimension indicators such as color uniformity, texture fidelity and overall quality score are calculated to construct the correction accuracy vector. The calculation of color uniformity adopts the tobacco leaf image processing method after removing the background, and the image data of the pure tobacco leaf area is obtained by multiplying the binary mask with the gray image, and then the image is normalized to adjust the pixel value range to 0 to 1. Then the average value and standard deviation of the tobacco leaf area pixels are calculated, the average gray value is obtained by calculating the average value of all pixel values in the tobacco leaf area, and the standard deviation value is obtained by calculating the square sum of the difference between the pixel value and the average value and then taking the square root. Then the number of pixels falling within the interval of average value plus or minus 3 times the standard deviation is counted, which usually covers 99.7% of the normal pixel distribution. Finally, the color uniformity indicator is defined by the ratio of the number of pixels in the interval to the total number of pixels in the tobacco leaf area, when the accuracy value in the correction accuracy vector reaches the range of 85% to 100%, it indicates that the correction processing reaches the expected effect, and the correction process can be completed, otherwise it needs to return to step S04 to re-correct the processing until the accuracy requirement is met.
[0051] The specific implementation of the conveyor optimal speed calculation function is to dynamically optimize the conveyor running speed according to the image correction effect and the conveyor running parameters. The function takes the correction accuracy vector, correction error vector, correction correlation matrix and current conveyor initial speed as input parameters, and determines the optimal conveyor running speed by analyzing the correlation between these parameters. When the correction accuracy is high and the correction error is small, the conveyor speed can be appropriately increased to improve the processing efficiency, and the speed increase range is usually 5% to 10% of the current speed. When the correction effect is not ideal, the conveyor speed needs to be reduced to obtain more stable image acquisition conditions, and the speed reduction range is usually 10% to 20% of the current speed. The optimal speed of the conveyor output by the function can maximize the tobacco processing efficiency under the premise of ensuring the image quality.
[0052] It should be noted that the key technical ideas of the present application mainly reflect in the multi-level distortion detection mechanism, the self-adaptive parameter adjustment strategy and the multi-scale image fusion processing, which are mutually coordinated to form a complete tobacco leaf image distortion correction enhancement system.
[0053] The multi-level distortion detection mechanism realizes comprehensive recognition and accurate positioning of image distortion through three different types of feature point detection: distortion segmentation points, distortion jump points, and distortion continuous points. This mechanism has significant technical advantages over traditional single threshold detection methods, as it can simultaneously capture gradual distortion caused by uneven lighting and sudden distortion caused by imaging devices, effectively solving the problem of low detection accuracy in complex lighting environments. By calculating the image gradient field based on the Poisson equation, this mechanism can accurately identify subtle lighting changes, offering stronger local adaptability and higher detection accuracy than traditional histogram equalization methods.
[0054] The adaptive parameter adjustment strategy realizes dynamic optimization and intelligent adjustment of correction parameters through a feedback mechanism that corrects error vectors and correlation matrices. This strategy has clear technical advantages over traditional correction methods with fixed parameters, as it can automatically adjust the intensity of light uniformization and the weight of fusion algorithms based on actual correction results, avoiding the subjectivity and limitations of manual parameter setting. By establishing a correlation matrix between distortion point types, this strategy can accurately analyze the spatial relationships and numerical correlations of different distortion types, providing a scientific basis for parameter adjustment and significantly improving the stability and reliability of correction processing.
[0055] The multi-scale image fusion processing technology uses the Laplacian pyramid algorithm to fuse multi-exposure tobacco leaf images, effectively preserving image detail information and significantly improving image quality. This technology has outstanding technical advantages over traditional single image processing methods, as it can fully utilize the complementary information of images under different exposure conditions, effectively addressing the issue of detail loss in high-light and shadow areas of single exposure images. By designing fusion rules based on local contrast and gradient amplitude, this technology can adaptively determine the fusion weights of different regions, offering better visual effects and higher information fidelity than traditional mean fusion or weighted average methods.
[0056] The synergistic effect of these three key technical approaches forms a strong technical advantage, realizing complete closed-loop control from distortion detection to parameter optimization and then to image fusion. Multi-level distortion detection provides accurate feature information for adaptive parameter adjustment, adaptive parameter adjustment provides optimized processing parameters for multi-scale image fusion, and the results of multi-scale image fusion provide quality feedback for distortion detection and parameter adjustment. This collaborative mechanism has significant systematic advantages over traditional independent processing methods, as it can achieve globally optimal correction results, significantly improving the quality and processing efficiency of cured tobacco leaf images and providing reliable technical support for tobacco quality detection and grading.
[0057] The present application also solves the technical problem of lack of adaptability to complex three-dimensional surface morphology in traditional tobacco image processing systems. In existing industrialized tobacco detection equipment, most systems are designed based on planar imaging theory, assuming that the detected object has a relatively flat surface, so the light source configuration, camera parameter setting and image processing algorithm design are optimized for two-dimensional planar features. This design concept has obvious limitations when faced with the complex three-dimensional surface morphology of cured tobacco. The present application establishes a multi-level spatial feature perception mechanism, including three-dimensional coordinate mapping of distortion segmentation points, spatial correlation analysis of distortion jump point matrix and morphology description of distortion continuous point vector, which can accurately perceive and quantify the three-dimensional geometric features of the tobacco surface. By correcting the correlation matrix, a mathematical correlation model between distortion features at different spatial positions is established. This three-dimensional perception capability enables the system to adjust the processing strategy according to the specific surface morphology features, significantly improving the processing adaptability of irregular surface tobacco.
[0058] In addition, the present application also solves the technical problem of coordination and optimization of optical information fidelity and processing efficiency in image fusion processing under multiple lighting conditions. Traditional image fusion techniques often face the contradiction between maintaining optical details and improving processing speed, especially when dealing with complex lighting distribution caused by uneven surfaces. Simple fusion algorithms can easily cause important optical features to be lost, while complex fusion algorithms can significantly increase computational burden. The present application uses Laplacian pyramid decomposition structure, by decomposing the complex lighting correction task into multiple scale level subtasks, using targeted fusion strategies at each scale, coarse scale mainly processing large-scale lighting changes, fine scale mainly maintaining local texture features. This hierarchical processing strategy not only ensures the integrity of optical information, but also significantly improves algorithm efficiency through parallel processing mechanism. Combined with a dynamic parameter adjustment mechanism, it can adaptively allocate computing resources according to the complexity of different images, maximizing computational efficiency while ensuring processing quality.
[0059] Specifically, the principle of this invention is as follows: The technical principle behind this invention's ability to solve image quality problems caused by uneven tobacco leaf surfaces lies in establishing a complete theoretical system for optical distortion recognition and correction. This system, starting from the physical mechanisms of light propagation and surface reflection, achieves accurate description and effective processing of image distortion under complex lighting conditions through mathematical modeling. First, addressing the shadow problem caused by uneven tobacco leaf surfaces, this invention employs a lighting homogenization algorithm based on the Poisson equation. By analyzing the distribution characteristics of the image gradient field, an ideal lighting model is reconstructed. The Poisson equation can effectively eliminate the uneven lighting phenomenon caused by surface undulations while maintaining the image edge and texture information. The core advantage of this method is its ability to distinguish between real tobacco leaf feature changes and false features caused by lighting changes, avoiding the image information loss that may be caused by traditional global brightness adjustment methods. Secondly, this invention constructs a three-tiered distortion feature description system, which can comprehensively capture different types of optical effects caused by unevenness on the tobacco leaf surface. Distortion segmentation point detection marks areas with drastic changes in illumination, the distortion jump point matrix is used to identify gray-level abrupt changes between adjacent areas, and the distortion continuous point vector describes the spatial distribution characteristics of large-area shadows or reflective areas. This multi-dimensional feature extraction strategy ensures comprehensive perception of various surface morphological changes. Thirdly, the application of the Laplacian pyramid image fusion algorithm solves the problem of collaborative processing of multi-scale optical distortion. By decomposing the image into different resolution levels, it can handle large-scale illumination changes at the coarse scale and preserve local texture details at the fine scale. Then, reconstruction is performed based on fusion rules of local contrast and gradient magnitude. This layered processing mechanism can effectively eliminate macroscopic illumination changes caused by undulations on the tobacco leaf surface while maintaining the integrity of the microscopic texture features of the tobacco leaf surface. Finally, the dynamic parameter adjustment mechanism established in this invention can adaptively adjust the illumination homogenization intensity and fusion algorithm weights according to the surface characteristics of specific tobacco leaf samples by real-time calculation of the correction error vector and correction correlation matrix. This adaptive capability ensures that the algorithm can maintain a stable correction effect when facing tobacco leaves with different degrees of surface unevenness, thereby achieving accurate correction of various optical distortions caused by changes in the surface morphology of tobacco leaves and a significant improvement in image quality.
[0060] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.
[0061] The specific implementation of step S01 involves detecting distortion segmentation points in the acquired image of cured tobacco leaves. This step employs an illumination homogenization algorithm based on the Poisson equation. First, the illumination threshold is calculated, specifically as follows:
[0062] ;
[0063] In the formula, is the illumination threshold value; is the pixel value of the real-time captured image; is the pixel value of the background image; is the image height; is the image width. Then, the Poisson equation is applied for the illumination homogenization processing, and the discrete form of the Poisson equation is expressed as follows:
[0064] ;
[0065] wherein, is the image gray value after homogenization; is the gradient divergence function; is the Laplace operator; is the pixel coordinate. The discrete expression of the equation is solved by the finite difference method as follows:
[0066] ;
[0067] wherein, is the grid spacing, and is usually taken as 1. The distortion segmentation point detection condition is:
[0068] ;
[0069] wherein, is the pixel value after the homogenization processing; is the original image pixel value.
[0070] The specific implementation of step S02 is to construct a distortion jump point matrix based on the distortion segmentation point. First, the grayscale processing is performed, and is specifically expressed as follows:
[0071] ;
[0072] wherein, is the grayscale value at the position ; is the red component pixel value; is the green component pixel value; is the blue component pixel value. The judgment condition of the distortion jump point detection algorithm is:
[0073] ;
[0074] wherein, is the jump threshold value, and is usually taken in the range of 20-35. The construction expression of the distortion jump point matrix is as follows:
[0075] ;
[0076] wherein, 1 represents the existence of distortion jump points, and 0 represents normal pixel points.
[0077] The specific implementation of step S03 is to process the multi-exposure tobacco leaf image through a Laplacian pyramid image fusion algorithm. The construction formula of the Gaussian pyramid is as follows:
[0078]
[0079] In the formula, is the pixel value of the Gaussian pyramid image at the position of the th layer; is a Gaussian kernel weight coefficient; is a pyramid level; and are offset values of the Gaussian kernel, and the value ranges are both -2 to 2. The calculation formula of the Laplacian pyramid is as follows:
[0080]
[0081] In the formula, is the pixel value of the Laplacian pyramid at the position of the th layer; is an up-sampling expansion function. The calculation formula of the fusion weight is as follows:
[0082]
[0083] In the formula, is the fusion weight at the position of the th layer; is a contrast weight; is a saturation weight; is an exposure weight; , , are weighting coefficients, and the value ranges are usually 0.3-0.7, 0.2-0.5, and 0.1-0.3, respectively. The expression of the distortion continuous point vector is as follows:
[0084]
[0085] In the formula, represents the feature value of the th continuous distortion feature point; is the total number of the continuous distortion feature points.
[0086] The specific implementation of step S04 is to calculate the correction error vector. The optimal segmentation threshold is obtained by maximizing the inter-class variance:
[0087] ;
[0088] wherein, is the inter-class variance; is the probability of a pixel being classified as class A; is the probability of a pixel being classified as class B; is the number of pixels with a gray value less than or equal to ; is the number of pixels with a gray value greater than ; is the total number of pixels in the image; is the mean value of class A pixels; is the mean value of class B pixels; is the number of pixels with a gray value ; is the gray value, which takes a value in the range of 0-255; is the segmentation threshold. The expression of the binary segmentation is:
[0089] ;
[0090] wherein, is the binary result. The calculation formula of the error vector after correction is:
[0091] ;
[0092] wherein, represents the color difference value of the th region; is the pixel value of the corrected image at position ; is the pixel value of the original image at position ; is the region number; is the total number of regions.
[0093] The specific implementation of step S05 is to establish a correction correlation matrix. The expression of the correlation matrix is:
[0094] ;
[0095] wherein, represents the correlation coefficient between the th distortion type and the th distortion type; and are the distortion type numbers, which take values of 1, 2, 3, corresponding to the distortion segmentation point, the distortion jump point, and the distortion continuous point, respectively. The calculation of the correlation coefficient is based on the inter-class variance:
[0096] ;
[0097] wherein, is the covariance between the first class and the second class; and are the variances of the first class and the second class, respectively.
[0098] The implementation of step S06 is the same as the foregoing, and will not be described in detail here.
[0099] The implementation of step S07 is to calculate the correction accuracy vector. The formula for calculating the tobacco image after removing the background is:
[0100] ;
[0101] wherein, is the tobacco image after removing the background; is the binary mask; is the grayscale image. The normalization processing formula is:
[0102] ;
[0103] wherein, is the normalized image; is the pixel value of the tobacco region, i.e. The calculation formula of the average value of the pixel value of the tobacco region is:
[0104] ;
[0105] wherein, is the average value of the pixel value of the tobacco region; is the area of the tobacco region. The calculation formula of the standard deviation of the tobacco region is:
[0106] ;
[0107] wherein, is the standard deviation of the tobacco region. The complete calculation formula of the number of pixels in the interval is:
[0108] ;
[0109] wherein, is an indicator function, which takes a value of 1 when the condition is met, and 0 otherwise. The definition formula of the color uniformity is:
[0110] ;
[0111] wherein, is the color uniformity. The correction accuracy vector is expressed as:
[0112] ;
[0113] wherein, is the texture fidelity; is the overall quality score.
[0114] It should be noted that the specific implementation of the conveyor optimal speed calculation function adopts a multi-parameter optimization model. The conveyor optimal speed is calculated by the formula:
[0115] ;
[0116] wherein, is the initial speed of the conveyor; is the average value of the correction accuracy vector; is the accuracy threshold value; is the average value of the correction error vector; is the maximum allowed error; is the average value of the correction correlation matrix; and are the minimum and maximum values of the correlation coefficient, respectively; , , are the adjustment coefficients, usually taking values in the ranges of 0.1-0.3, 0.2-0.4, and 0.05-0.15, respectively.
[0117] It should be noted that the illumination threshold calculation formula is based on the image difference value statistical principle, and the detection threshold of illumination change is adaptively determined by calculating the global difference between the real-time image and the background image.
[0118] ;
[0119] This formula can be dynamically adjusted according to the actual illumination conditions, significantly improving the accuracy and adaptability of distortion detection, and effectively solving the problem of inconsistent detection precision under different illumination environments.
[0120] The Poisson equation is based on the gradient field reconstruction principle, and the uniform distribution of illumination is realized by solving the Laplacian of the image.
[0121] ;
[0122] The equation can maintain the image edge and texture information while smoothing the light change, has better local adaptability and edge preservation ability than the traditional histogram equalization method, and significantly improves the visual quality of tobacco image.
[0123] The Laplacian pyramid fusion weight formula is based on the multi-feature weighted fusion principle, and comprehensively considers the image quality indexes of contrast, saturation and exposure.
[0124] ;
[0125] The formula realizes the optimal fusion of different exposure images through adaptive weight distribution, and can better preserve image details and color information than the simple average fusion method, greatly improving the overall quality of the fused image.
[0126] The inter-class variance formula is based on the statistical segmentation principle, and determines the optimal segmentation threshold by maximizing the inter-class difference between the foreground and background.
[0127] ;
[0128] The formula can automatically find the optimal binaryzation segmentation point of the image, and has stronger adaptability and higher segmentation accuracy than the fixed threshold segmentation method, providing a reliable foundation for subsequent error calculation and correlation analysis.
[0129] The color uniformity calculation formula is based on the statistical distribution principle, and quantifies the color consistency of the image by calculating the proportion of pixels falling within the normal distribution interval. The indicator function of pixel count is:
[0130] ;
[0131] The formula covers 99.7% of the normal pixel distribution using the 3 standard deviation criterion, and can more accurately reflect the color uniformity of the image than the simple variance calculation method, providing an objective and reliable quantitative index for tobacco quality evaluation.
[0132] The conveyor optimal speed calculation formula is based on the multi-parameter coupling optimization principle, and comprehensively considers multiple factors such as image correction effect, processing error and system correlation.
[0133] ;
[0134] The formula establishes a quantitative relationship between image quality and conveyor speed, and can realize dynamic optimization and adaptive adjustment compared with the fixed speed control method, effectively improving the efficiency and stability of the entire tobacco image processing system.
[0135] For better understanding and implementation of the present application, the following provides an embodiment 2 of a specific application scenario of the present application: a technical team establishes a tobacco leaf image acquisition device in a certain tobacco processing workshop to solve the technical problem of image distortion affecting detection accuracy in the process of tobacco quality detection. The device mainly includes a conveyor belt with a length of 8000 mm and a width of 1200 mm, an industrial camera with a resolution of 4096x3072 pixels, an LED light source array with a power of 150 W, and an operation device equipped with an Intel i3 processor, as shown in Figure 2 .
[0136] In the system initialization phase, the technical team first detects the distortion segmentation points of the obtained cured tobacco leaf images. By calculating the image gradient field based on the Poisson equation illumination homogenization algorithm, the illumination threshold is set to 0.15, and when the difference between the real-time shooting image and the background image exceeds the threshold, the system automatically identifies and marks it as a distortion segmentation point. In a group of 3000x2400 pixel tobacco leaf images, the system detects 347 distortion segmentation points, mainly distributed in the edge and vein area of the tobacco leaf. By solving the Poisson equation by finite difference method, the system obtains a uniform illumination distribution, effectively eliminating the alternating bright and dark phenomenon in the original image caused by uneven light source.
[0137] Based on the detected distortion segmentation points, the system constructs a 347x347 dimensional distortion jump point matrix. Statistical analysis is performed on the gray difference between adjacent distortion segmentation points, and the jump threshold is set to 25. When the gray difference exceeds the threshold, the corresponding point is marked as a distortion jump point. After processing, the system identifies 156 distortion jump points, and the element values of the corresponding positions in the matrix are set to 1, and the rest are set to 0. As shown in Figure 3 , the distortion jump points are mainly concentrated in the areas with sharp changes in tobacco texture, providing accurate positioning information for subsequent correction processing.
[0138] The system uses a Laplacian pyramid image fusion algorithm to process multiple exposure tobacco leaf images, a total of 5 images with different exposure times, exposure times are 1 / 250s, 1 / 125s, 1 / 60s, 1 / 30s and 1 / 15s. Each input image is decomposed into 4 different scale Laplacian pyramids, and a fusion rule is designed based on local contrast and gradient amplitude, where the contrast weight is set to 0.6 and the gradient amplitude weight is set to 0.4. During the fusion process, the system reconstructs to obtain a high-quality fusion image, and the dynamic range is improved by 68% compared with the original image, while extracting a distortion continuous point vector with a length of 2048, which describes the continuity distribution characteristics of the distortion area in the tobacco leaf image.
[0139] To evaluate the correction effect, the system calculates the correction error vector, which compares the fused image with the original image at the pixel level. By counting the color difference values of each region, the system finds that 67% of the pixel regions have color difference values less than 10, 23% of the pixel regions have color difference values between 10 and 20, and 10% of the pixel regions have color difference values exceeding 20. Setting the error threshold to 15, when the color difference value exceeds the threshold, the system records the error information at the corresponding position, and constructs a correction error vector with a length of 1024. This vector contains 203 error values exceeding the threshold, mainly distributed in the tobacco leaf edge and complex texture regions.
[0140] As shown in Table 1, the system establishes a correction correlation matrix to analyze the spatial relationship and numerical correlation between the distortion segmentation point, distortion jump point, and distortion continuous point vectors.
[0141] Table 1 Correction correlation matrix parameter table
[0142]
[0143] By calculating the correlation coefficient between each point, the system forms a 3x3-dimensional correction correlation matrix, which guides the dynamic adjustment of subsequent correction parameters.
[0144] In the parameter adjustment stage, the system dynamically adjusts the correction parameters according to the correction error vector and the correction correlation matrix. When the error value in the correction error vector exceeds the set error threshold of 15, the system automatically increases the light uniformization processing intensity, increasing the processing intensity from the initial value of 1.2 to 1.8. When the correlation coefficient in the correction correlation matrix is lower than the standard correlation value of 0.7, the system reduces the weight parameter of the fusion algorithm, adjusting the contrast weight from 0.6 to 0.45 and the gradient amplitude weight from 0.4 to 0.55. After 3 iterations of adjustment, the system correction parameters tend to be stable.
[0145] As shown in Table 2, the system calculates the correction accuracy vector by comparing the corrected image with the standard tobacco leaf image.
[0146] Table 2 Correction accuracy evaluation results table
[0147]
[0148] The statistical color uniformity index shows that the color uniformity of the corrected image reaches 0.891, exceeding the lower limit of the set accuracy range of 85%, and the system completes the correction process. In the color uniformity calculation process, the normalized processing result of the tobacco leaf image after removing the background shows that the average value of the tobacco leaf region pixels is 0.647, the standard deviation is 0.083, and the number of pixels within the interval accounts for 89.1% of the total tobacco leaf area.
[0149] As Figure 4As shown, the system also implements the optimal speed calculation function of the conveyor belt, dynamically optimizes the running speed of the conveyor belt according to the image correction effect and the running parameters of the conveyor belt. The input parameters include the correction accuracy vector, the correction error vector, the correction correlation matrix and the initial speed of the current conveyor belt 2.5 m / s. After optimization calculation, the system outputs the optimal speed of the conveyor belt as 1.8 m / s. At this speed, the camera can obtain clearer tobacco leaf images, the distortion phenomenon is significantly reduced, and the image quality is obviously improved. As shown in FIG. 6, the system outputs the optimal speed of the conveyor belt as 1.8 m / s. At this speed, the camera can obtain clearer tobacco leaf images, the distortion phenomenon is significantly reduced, and the image quality is obviously improved. Figures 5 to 7 As shown in FIG. 7, it is a correction error vector distribution statistical chart and a reconstruction quality score effect chart and a reconstruction weight coefficient chart of a multi-scale Laplace pyramid in the embodiment.
[0150] The main progress brought by the present application relative to the traditional means is reflected in multiple technical aspects. First, the light uniformization algorithm based on the Poisson equation fundamentally solves the limitation of the traditional method that only processes light unevenness through simple filtering, and obtains the optimal light distribution by solving the partial differential equation, thereby realizing more accurate light correction. Second, the introduction of the distortion jump point matrix breaks through the bottleneck of the traditional method that only relies on single feature point detection, and systematically records and analyzes the gray jump phenomenon between adjacent pixels through the construction of a two-dimensional matrix structure, thereby providing more comprehensive and accurate information for distortion detection. Third, the application of the Laplace pyramid image fusion algorithm changes the traditional single image processing idea, realizes the organic fusion of image information under different exposure conditions through multi-scale decomposition and reconstruction, and significantly improves the dynamic range and detail performance of the image. Fourth, the establishment of the correction correlation matrix innovatively introduces the concept of correlation analysis between different distortion features, quantifies the spatial relationship and numerical correlation degree between various distortion point types, provides a scientific basis for dynamic parameter adjustment, and realizes the transition from experience-driven to data-driven. Fifth, the design of the closed-loop feedback mechanism ensures the adaptability and robustness of the correction process, solves the problem of insufficient adaptability of the traditional fixed parameter method in the face of complex changing environment by monitoring the correction effect in real time and dynamically adjusting the parameters.
[0151] It should be noted that the variables involved in the present application are explained in detail as shown in Tables 3 and 4.
[0152] Table 3 Variable explanation table (first part)
[0153]
[0154] Table 4 Variable explanation table (second part)
[0155]
[0156] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application.
Claims
1. A method for image distortion correction and enhancement of roasted tobacco leaves, characterized in that, The process includes: detecting distortion segmentation points in acquired images of roasted tobacco leaves; calculating the image gradient field using a Poisson-based illumination homogenization algorithm; obtaining a homogenized illumination distribution by solving the Poisson equation using the finite difference method; identifying regions where illumination changes exceed an illumination threshold and marking them as distortion segmentation points; constructing a distortion jump point matrix based on these segmentation points; statistically analyzing the gray-level differences between adjacent distortion segmentation points; marking points as distortion jump points when the gray-level difference exceeds a jump threshold; processing multi-exposure tobacco leaf images using a Laplacian pyramid image fusion algorithm; decomposing each input image into Laplacian pyramids of different scales; designing fusion rules based on local contrast and gradient magnitude; reconstructing a high-quality fused image and extracting distortion continuous point vectors; calculating a correction error vector; comparing the fused image with the original image at the pixel level; statistically analyzing the color difference values of each region; recording the error information at the corresponding position when the color difference value exceeds an error threshold; and constructing a correction error vector. A correction correlation matrix is established to analyze the spatial relationship and numerical correlation between the vectors of distortion segmentation points, distortion jump points, and distortion continuous points. The correlation coefficient between each point is calculated to form the correction correlation matrix. The correction parameters are dynamically adjusted according to the correction error vector and the correction correlation matrix. When the error value in the correction error vector exceeds the set error threshold, the intensity of the illumination homogenization process is increased. When the correlation coefficient in the correction correlation matrix is lower than the standard correlation value, the weight parameters of the fusion algorithm are reduced. The correction accuracy vector is calculated, and the corrected image is compared and analyzed with a standard tobacco leaf image. Color uniformity indices are statistically analyzed. Correction is complete when the accuracy value in the correction accuracy vector reaches the specified range; otherwise, correction is repeated. The correction correlation matrix is also included. The expression is: ; In the formula, Indicates the first Type of distortion and the first Correlation coefficients between different types of aberrations; and These are the distortion type numbers, with values of 1, 2, and 3, corresponding to the distortion cutoff point, distortion jump point, and distortion continuity point, respectively. The correlation coefficient is calculated based on the inter-class variance. ; In the formula, For the first Class and First Covariance between classes; and The first Class and First Class variance; The formula for calculating the tobacco leaf image after background removal is: ; In the formula, The image of tobacco leaves after removing the background; For binary masking; For grayscale images, the normalization formula is: ; In the formula, The image is after normalization; The pixel value of the tobacco leaf area, i.e. The formula for calculating the average pixel value in the tobacco leaf area is: ; In the formula, This represents the average pixel value of the tobacco leaf area. The formula for calculating the standard deviation of a tobacco leaf area is: ; In the formula, The standard deviation of the tobacco leaf area represents the number of pixels within the interval. The complete calculation formula is: ; In the formula, This is an indicator function that takes a value of 1 when the condition is met and 0 otherwise. The formula for defining color uniformity is: ; In the formula, For color uniformity, the accuracy vector is corrected. The expression is: ; In the formula, For texture fidelity; Score the overall quality.
2. The method for image distortion correction and enhancement of roasted tobacco leaves according to claim 1, characterized in that, The distortion segmentation point detection step specifically involves identifying pixel locations in the image of roasted tobacco leaves where color changes abruptly due to uneven illumination or imaging distortion. These locations are determined by calculating points in the image gradient field where the gradient magnitude exceeds a preset illumination threshold. The illumination threshold is calculated using a marker variable, which is obtained by summing the absolute values of the differences between the red, green, and blue components of the real-time captured image and the background image, and then dividing by three times the product of the image's length and width.
3. The method for image distortion correction and enhancement of roasted tobacco leaves according to claim 2, characterized in that, The steps for constructing the distortion jump point matrix are as follows: the distortion jump point matrix is a two-dimensional array structure that records significant jumps in grayscale values between adjacent pixels. A value of 1 in the matrix element indicates that there is a distortion jump point at the location, and a value of 0 indicates that it is normal. The grayscale value of each pixel is calculated by averaging the red, green, and blue components using the grayscale processing formula, and then jump detection is performed.
4. The method for image distortion correction and enhancement of roasted tobacco leaves according to claim 3, characterized in that, The Laplacian pyramid image fusion algorithm specifically involves the following steps: the distortion continuous point vector is a one-dimensional array describing the continuous distribution characteristics of the distortion region in the image. The Laplacian pyramid image fusion algorithm extracts continuous distortion feature points at different scales to form a vector, which is used to characterize the spatial continuity of the distortion. Each input image is decomposed into a Laplacian pyramid structure at different scales, and feature extraction and fusion processing are performed at each level based on local contrast and gradient magnitude.
5. The method for image distortion correction and enhancement of roasted tobacco leaves according to claim 4, characterized in that, The step of calculating the correction error vector specifically involves using a one-dimensional array structure to quantify the differences between the images before and after correction. This array is constructed by calculating the color difference values at each pixel position between the original image and the corrected image. The color difference calculation uses a binary segmentation method to divide the region. When the pixel gray value is greater than the optimal segmentation threshold, it is marked as 1, and when the pixel gray value is less than or equal to the optimal segmentation threshold, it is marked as 0. The optimal segmentation threshold is obtained by maximizing the inter-class variance.
6. The method for image distortion correction and enhancement of roasted tobacco leaves according to claim 5, characterized in that, The step of dynamically adjusting the correction parameters specifically involves adaptively adjusting the processing parameters based on the calculation results of the correction error vector and the correction correlation matrix. When the error value detected in the correction error vector exceeds the preset error threshold, the processing intensity of the illumination homogenization algorithm is automatically increased. When the correlation coefficient in the correction correlation matrix is lower than the standard correlation threshold, the weight parameter setting of the Laplacian pyramid image fusion algorithm is reduced.
7. The method for image distortion correction and enhancement of roasted tobacco leaves according to claim 6, characterized in that, The accuracy range judgment criterion is specifically that when the accuracy value in the correction accuracy vector reaches the range of 85% to 100%, the correction process is considered complete. When the accuracy value does not reach the range, the correction error vector calculation step is returned to perform iterative correction again until the accuracy index meets the preset requirements, thus forming a closed-loop correction optimization processing mechanism.
8. The method for image distortion correction and enhancement of roasted tobacco leaves according to claim 7, characterized in that, It also includes a conveyor belt optimal speed calculation function, which is used to dynamically optimize the conveyor belt speed based on the image correction effect and the conveyor belt operating parameters. The input includes the correction accuracy vector, the correction error vector, the correction correlation matrix and the current initial speed of the conveyor belt, and the output is the optimal speed of the conveyor belt. The image acquisition quality is optimized by analyzing the correlation between image quality and conveyor belt speed.
Citation Information
Patent Citations
Depth image correction method, device and equipment
CN108961184A
Brightness compensation method for non-uniform illumination tobacco leaf image
CN112330568A