A method and computer device for screening ROI regions of tea hyperspectral images
Through the ROI area screening method of tea hyperspectral image, the meat leaf and main leaf vein areas of tea leaves were separated, the reflectance correlation coefficient was calculated, and the evaluation model was constructed, which solved the problems of background interference and uneven composition in the existing tea bud detection, and achieved the accuracy and efficiency of tea quality analysis.
Patent Information
- Application Number
- CN202411313213.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2044-09-20
AI Technical Summary
The existing tea bud leaf target detection methods have the problems of large interference in the background area and uneven distribution of target components in regression box detection, and it is difficult to accurately select the ROI area containing more target components.
The ROI region screening method of tea hyperspectral image was used, and the hyperspectral image of tea leaves was obtained for pre-processing, and the main leaf veins and leaf images were divided. After removing the main leaf veins, the meat leaf image was obtained, the reflectivity of the ROI of the meat leaf was calculated, the correlation coefficient between the target components and the reflectivity was established, and the reflectivity evaluation model was constructed to select the optimal reflectivity and ROI region.
The precise separation of the meat and main vein areas of the tea leaves is achieved, and the ROI area containing more target components can be accurately selected, which improves the accuracy and efficiency of tea quality analysis.
Smart Images

Figure CN119206180B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of spectral data processing, and in particular to a method for screening ROI regions of tea hyperspectral images and computer equipment. Background Art
[0002] Tea is rich in nutrients such as tea polyphenols, catechins, amino acids, and caffeine, and has become a widely consumed beverage. Demand for high-quality tea continues to increase, and computer vision-based tea bud and leaf segmentation methods have been widely used in tea quality analysis in recent years.
[0003] To better optimize the robot's detection and positioning performance for fresh tea buds, many researchers have conducted extensive research on traditional image processing algorithms and deep learning algorithms. Existing tea bud and leaf target detection methods suffer from two problems. The first is that most tea bud and leaf target detection methods use regression boxes to detect tea bud and leaf targets. These boxes include background areas, significantly interfering with segmentation performance. The second problem is that the distribution of detected tea bud and leaf target components is uneven across the leaf. Certain target components are concentrated in certain areas of the leaf, for example, cellulose is concentrated in the veins, while nutrients are concentrated in the mesophyll.
[0004] Therefore, a method is needed to separate the mesophyll area and the main vein area of the tea leaf, establish the correlation coefficient between the target component and the reflectivity, and thus accurately select the ROI area containing more target components. Summary of the Invention
[0005] In order to overcome the problems existing in the related art, one of the objectives of the present invention is to provide a ROI area screening method for tea hyperspectral images, which can separate the mesophyll area and the main vein area of the tea leaves, establish the correlation coefficient between the target component and the reflectivity, and thus accurately select the ROI area containing more target components.
[0006] A method for screening ROI regions of tea hyperspectral images, comprising:
[0007] Acquiring a hyperspectral image of tea leaves, and preprocessing the hyperspectral image to obtain a preprocessed image;
[0008] Performing image segmentation on the preprocessed image to obtain a main vein image and a leaf image;
[0009] removing the main vein image from the leaf image to obtain a mesophyll image;
[0010] Extracting a mesophyll ROI matrix from the mesophyll image, and dividing M types of mesophyll ROIs according to the distances between different mesophyll ROI matrices;
[0011] Calculating the reflectivity of the main vein image and the M-type mesophyll ROI to obtain the M+1-type reflectivity;
[0012] Calculating the correlation coefficient between the target component of the tea leaves and each of the reflectances, and constructing a reflectance evaluation model based on the correlation coefficients;
[0013] The reflectivity evaluation model is used to select the optimal reflectivity and the corresponding final ROI area.
[0014] In a preferred technical solution of the present invention, performing image segmentation on the pre-processed image to obtain a main vein image and a leaf image includes:
[0015] Inputting the preprocessed image into an image segmentation model for image segmentation to obtain a leaf image;
[0016] Filtering a plurality of first-category edge pixel points of the leaf from the leaf image;
[0017] Performing translation cutting on the leaf image according to the coordinates of the first type of edge pixel points to obtain a plurality of main vein regions;
[0018] A plurality of the main vein regions are combined to obtain a main vein image.
[0019] In a preferred technical solution of the present invention, the leaf image is translated and cut according to the coordinates of the first type of edge pixel points to obtain multiple main vein regions, including:
[0020] Selecting a starting point from the first type of edge pixel points; wherein the first type of edge pixel points correspond to the edge of the tea leaf;
[0021] Draw a detection frame with the starting point as the center;
[0022] The detection frame is translated to cut the leaf image until the entire leaf area is traversed to obtain multiple detection frame images;
[0023] Extracting an image edge from each of the detection frame images, removing the first type of edge pixel points from the image edge, and obtaining a second type of edge pixel points;
[0024] The second-category edge pixel points belonging to the same detection frame image are connected to obtain a plurality of main vein regions.
[0025] In a preferred technical solution of the present invention, dividing M types of mesophyll ROIs according to the distances between different mesophyll ROI matrices includes:
[0026] The KNN clustering algorithm is used to cluster the Euclidean distances between different mesophyll ROI matrices to obtain M types of mesophyll ROIs.
[0027] In a preferred technical solution of the present invention, the calculating the reflectivity of the main vein image and the M types of mesophyll ROIs to obtain the M+1 type reflectivity includes:
[0028] Obtaining P main vein images, and calculating the first type reflectivity of the P main vein images;
[0029] Screening out K first-category reflectances with the highest similarity from the P main vein images, calculating the average of the K first-category reflectances with the highest similarity to obtain the reflectance of the main vein image;
[0030] Obtain P i-th mesophyll ROIs, and calculate the second-category reflectance of the P i-th mesophyll ROIs;
[0031] K reflectances of the second category with the highest similarity are screened out from P i-th mesophyll ROIs, and the mean of the K reflectances of the second category with the highest similarity is calculated to obtain the reflectance of the i-th mesophyll ROI; wherein 1≤i≤M.
[0032] In a preferred technical solution of the present invention, the calculation of the correlation coefficient between the target component of the tea leaves and each of the reflectances includes:
[0033] Obtaining N tea leaves and corresponding N*(M+1) reflectivities;
[0034] Calculate the correlation coefficients between the target components of the N tea leaves and the corresponding N*(M+1) reflectivities; wherein the target components include moisture content, cellulose content and tea polyphenol content.
[0035] In a preferred technical solution of the present invention, the preprocessing of the hyperspectral image to obtain the preprocessed image includes:
[0036] Performing black-white correction on the hyperspectral image to obtain a black-white corrected image;
[0037] Performing grayscale conversion on the black-and-white corrected image to obtain a grayscale image;
[0038] Perform guided filtering on the grayscale image to obtain a preprocessed image.
[0039] In a preferred technical solution of the present invention, the step of constructing a reflectivity evaluation model based on the correlation coefficient includes:
[0040] Performing principal component analysis on the hyperspectral image to obtain principal components;
[0041] If the correlation coefficient is greater than the correlation coefficient threshold, a partial least squares regression estimation model between the principal component and the target component is constructed.
[0042] In a preferred technical solution of the present invention, the use of the reflectivity evaluation model to select the optimal reflectivity and the corresponding final ROI area includes:
[0043] The model determination coefficient R 2 evaluating the partial least squares regression estimation model to obtain a first score;
[0044] The relative analytical error (RPD) is used to evaluate the partial least squares regression estimation model to obtain a second score;
[0045] The normalized root mean square error (NRMSE) is used to evaluate the partial least squares regression estimation model to obtain a third score;
[0046] Calculating a comprehensive score based on the first score, the second score, and the third score;
[0047] The reflected ROI region corresponding to the maximum value of the comprehensive score is used as the final ROI region.
[0048] A second object of the present invention is to provide a computer device comprising a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of any one of the above-mentioned methods for screening ROI areas of tea hyperspectral images when executing the computer program.
[0049] The beneficial effects of the present invention are:
[0050] The present invention provides a method for screening ROI regions in tea leaf hyperspectral images. The method comprises obtaining a hyperspectral image of tea leaves, preprocessing the hyperspectral image to obtain a preprocessed image, and then performing image segmentation on the preprocessed image to obtain a main vein image and a leaf image. Tea leaves comprise main veins and mesophyll. The main vein image is removed from the leaf image to obtain the mesophyll image. The mesophyll image is a grayscale image, and the mesophyll image is converted into a grayscale matrix. The distances between different matrices are calculated, and the mesophyll ROIs are classified into M categories based on the distances between the matrices. The mesophyll and main veins represent different regions of the leaf. Mesophyll occupies a large portion of the leaf area, so mesophyll has multiple types, each with different reflectivities. The reflectivities of the main vein image and the M mesophyll ROIs are calculated, resulting in a total of M+1 reflectivities. The correlation coefficient between the target component of the tea leaves and each reflectivity is calculated, and a reflectivity evaluation model is constructed based on the correlation coefficients. The reflectivity evaluation model is used to select the optimal reflectivity and the corresponding final ROI region. The correlation coefficient reflects the relationship between the local image features of the mesophyll and main veins and their reflectance. The reflectance assessment model includes multiple evaluation methods. Combining these methods comprehensively measures the reflectance assessment model's fit and prediction accuracy for hyperspectral images of tea leaves. The above method separates the mesophyll and main vein regions of tea leaves and uses the reflectance assessment model to select the optimal reflectance and the corresponding final ROI region. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flow chart of the tea hyperspectral image ROI area screening method of the present invention;
[0052] Figure 2 is a schematic diagram of a preprocessed image of the present invention;
[0053] Figure 3 is a binary image of the leaf image of the present invention;
[0054] Figure 4 is a binary image of the main vein image of the present invention;
[0055] Figure 5 is a profile diagram of a tea leaf of the present invention;
[0056] Figure 6 It is an outline diagram of the main leaf vein of the present invention. DETAILED DESCRIPTION
[0057] The preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although preferred embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. Rather, these embodiments are provided to make the present invention more thorough and complete and to fully convey the scope of the present invention to those skilled in the art.
[0058] Example 1
[0059] like Figures 1-6 As shown, this embodiment provides a method for screening ROI regions of tea hyperspectral images, including:
[0060] S1: Acquire a hyperspectral image of tea leaves, and preprocess the hyperspectral image to obtain a preprocessed image.
[0061] Step S1 includes the following steps S11-S13:
[0062] S11: performing black-white correction on the hyperspectral image to obtain a black-white corrected image.
[0063] S12: performing grayscale conversion on the black-and-white corrected image to obtain a grayscale image.
[0064] S13: Performing guided filtering on the grayscale image to obtain a preprocessed image.
[0065] The hyperspectral image is corrected for black and white according to the following formula:
[0066]
[0067] Among them, I0 is the black and white corrected image, lg represents the logarithmic function, I is the hyperspectral image, I D is a black frame image, I W is a white frame image, and the black frame image and the white frame image are used to calibrate the hyperspectral image of tea leaves collected by the hyperspectral camera.
[0068] When acquiring hyperspectral images, image quality can be affected by factors such as dark current noise, detector sensitivity, and optical transmission characteristics. Black-white correction corrects for noise and bias in the raw data by acquiring white frames with a reflectivity close to 100% and black frames with a reflectivity close to 0%, thereby improving the quality and accuracy of hyperspectral images.
[0069] The RGB pixel values of the black and white corrected image are weighted summed to convert the black and white corrected image in RGB form into a grayscale image. The grayscale conversion of the black and white corrected image is performed according to the following formula:
[0070] Gray=0.299*R+0.587*G+0.114*B;
[0071] Among them, Gray is the grayscale value of the grayscale image, R is the value of the red channel of the black and white corrected image, G is the value of the green channel of the black and white corrected image, and B is the value of the blue channel of the black and white corrected image.
[0072] The definition of guided filtering uses a local linear model. This model assumes that a point on a function has a linear relationship with its neighboring points. A complex function can be represented by many local linear functions. To determine the value of a point on a function, simply calculate the values of all the linear functions that contain that point and average them. Considering a grayscale image as a two-dimensional function, which cannot be represented analytically, guided filtering assumes that the output and input are linearly related within a two-dimensional window. The formula for guided filtering is as follows:
[0073] q i =a k I i +b k ;
[0074] Among them, q i is the preprocessed image, I i To guide the image, a k is the multiplicative coefficient, b k is the additive coefficient, and i represents the image number.
[0075] Guided filtering is a process of denoising the input grayscale image while minimizing the difference between the output preprocessed image and the input grayscale image, so that the preprocessed image q i With the grayscale image p i have the same image characteristics.
[0076] S2: performing image segmentation on the pre-processed image to obtain a main vein image and a leaf image.
[0077] Step S2 includes the following steps S21-S24:
[0078] S21: Inputting the preprocessed image into an image segmentation model for image segmentation to obtain a leaf image.
[0079] S22: Filtering out a plurality of first-category edge pixel points of the leaf from the leaf image.
[0080] S23: performing translation cutting on the leaf image according to the coordinates of the first type of edge pixel points to obtain a plurality of main vein regions.
[0081] S24: combining the plurality of main vein regions to obtain a main vein image.
[0082] This embodiment takes the Mask-RCNN model as an example of an image segmentation model. The Mask-RCNN model includes a backbone network, a region generation network, a proposal layer, and an object detection layer. The Mask-RCNN model can output high-quality instance segmentation masks while effectively detecting objects.
[0083] The image corresponding to the leaf mask output by the Mask-RCNN model is used as the leaf image. Edge points on the mask, i.e., points at the intersection of pixel values 0 and 1, are considered first-class edge pixels. The leaf image is then subjected to translational segmentation based on the coordinates of the first-class edge pixels to obtain multiple main vein regions. These regions are then combined based on their relative positions to obtain a main vein image.
[0084] Step S23 includes the following steps S231-S235:
[0085] S231: Selecting a starting point from the first type of edge pixel points; wherein the first type of edge pixel points correspond to the edge of the tea leaf.
[0086] S232: Draw a detection frame with the starting point as the center.
[0087] S233: translating the detection frame to cut the leaf image until the entire leaf region is traversed to obtain a plurality of detection frame images.
[0088] S234: Extracting image edges from each of the detection frame images, removing the first category of edge pixels from the image edges, and obtaining second category of edge pixels.
[0089] S235: Connect the second-category edge pixel points belonging to the same detection frame image to obtain a plurality of main vein regions.
[0090] The edge of the tea leaf is closed, so a pixel point can be randomly selected from the first type of edge pixel points representing the edge of the tea leaf and used as the starting point.
[0091] Use a rectangular detection frame and adjust its size based on the leaf image. This example uses a 2*2 rectangular detection frame as an example. Centered at the starting point, the rectangular detection frame is translated along the main vein, horizontally, vertically, or diagonally, with a translation step of 1. After each translation, a screenshot of the rectangular detection frame is taken using the coordinates of its upper-left corner, and the detection frame image is saved.
[0092] The size of the detection frame image is small, so the image edge of the detection frame image can be quickly extracted after one translation. Then, the first-class edge pixels belonging to the leaf edge are eliminated, and the remaining pixels in each main vein area are the second-class edge pixels. All the main vein areas containing only the second-class edge pixels are combined to obtain the main vein image. The main vein image is as follows: Figure 4 and Figure 6 As shown, the main veins are long and thin strips.
[0093] S3: removing the main vein image from the leaf image to obtain a mesophyll image.
[0094] S4: extracting a mesophyll ROI matrix from the mesophyll image, and dividing M types of mesophyll ROIs according to the distances between different mesophyll ROI matrices.
[0095] The KNN (K-Nearest Neighbor) clustering algorithm was used to cluster the Euclidean distances between the different mesophyll ROI matrices to obtain M types of mesophyll ROIs. The Euclidean distances between the grayscale matrices were calculated and the KNN clustering algorithm was used to classify them into three categories based on the Euclidean distances, i.e., M = 3, resulting in three types of mesophyll ROIs.
[0096] S5: Calculate the reflectivity of the main vein image and the M-type mesophyll ROI to obtain the M+1-type reflectivity.
[0097] Step S5 includes the following steps S51-S54:
[0098] S51: Acquire P main vein images, and calculate the first type reflectivity of the P main vein images.
[0099] S52: Filtering out K first-category reflectances with the highest similarity from the P main vein images, calculating the average of the K first-category reflectances with the highest similarity, and obtaining the reflectance of the main vein image.
[0100] S53: Obtain P i-th mesophyll ROIs, and calculate the second-category reflectance of the P i-th mesophyll ROIs.
[0101] S54: Filtering out K reflectances of the second category with the highest similarity from P i-th mesophyll ROIs, calculating the mean of the K reflectances of the second category with the highest similarity, and obtaining the reflectance of the i-th mesophyll ROI; wherein 1≤i≤M.
[0102] The number of main vein images, first-category mesophyll ROIs, second-category mesophyll ROIs, and third-category mesophyll ROIs is P, where P > 5. The reflectance of the main vein images and the three mesophyll ROIs is extracted. There are four categories of reflectance in total. For each category, the five reflectances with the highest similarity are selected, i.e., K = 5. The average of these five reflectances is calculated to obtain the four categories of reflectance.
[0103] S6: Calculate the correlation coefficient between the target component of the tea leaves and each of the reflectances, and construct a reflectance evaluation model based on the correlation coefficients.
[0104] S7: Using the reflectivity evaluation model, the optimal reflectivity and the corresponding final ROI area are selected.
[0105] The hyperspectral images corresponding to the four types of reflectance obtained in step S5 are sequentially subjected to principal component analysis and target components are selected. The target components include moisture content, cellulose content, and tea polyphenol content.
[0106] The correlation coefficient between the target component of the tea leaf and each reflectance is calculated. A reflectance evaluation model is constructed based on the correlation coefficients, and the optimal reflectance and corresponding final ROI region are selected using the reflectance evaluation model. The correlation coefficient reflects the relationship between the local image features of the mesophyll and main veins and the reflectance. The reflectance evaluation model includes multiple evaluation methods. Combining these methods can comprehensively measure the reflectance evaluation model's fit and prediction accuracy for the hyperspectral image of the tea leaf. This method separates the mesophyll and main vein regions of the tea leaf and uses the reflectance evaluation model to select the optimal reflectance and corresponding final ROI region.
[0107] The tea leaf hyperspectral image ROI screening method of this embodiment includes acquiring a hyperspectral image of a tea leaf, preprocessing the hyperspectral image to obtain a preprocessed image, and then performing image segmentation on the preprocessed image to obtain a main vein image and a leaf image. Tea leaves consist of main veins and mesophyll. The mesophyll image is obtained by removing the main vein image from the leaf image. The mesophyll image is a grayscale image, and the mesophyll image is converted into a grayscale matrix. The distances between different matrices are calculated, and the mesophyll ROIs are classified into M categories based on the distances between the matrices. The mesophyll and main veins represent different regions of the leaf leaf. Mesophyll occupies a large portion of the leaf area, so mesophyll has multiple types, each with different reflectances. The reflectances of the main vein image and the M mesophyll ROIs are calculated, resulting in a total of M+1 reflectance categories. The correlation coefficient between the target component of the tea leaf and each reflectance is calculated. A reflectance evaluation model is constructed based on the correlation coefficients, and the optimal reflectance and corresponding final ROI region are selected using the reflectance evaluation model. The correlation coefficient reflects the relationship between the local image features of the mesophyll and main veins and their reflectance. The reflectance assessment model includes multiple evaluation methods. Combining these methods comprehensively measures the reflectance assessment model's fit and prediction accuracy for hyperspectral images of tea leaves. The above method separates the mesophyll and main vein regions of tea leaves and uses the reflectance assessment model to select the optimal reflectance and the corresponding final ROI region.
[0108] Example 2
[0109] like Figures 1-6 As shown, this embodiment provides a method for screening ROI regions of tea leaf hyperspectral images. This embodiment only describes the differences from Example 1. The calculation of the correlation coefficient between the target component of the tea leaf and each of the reflectances includes:
[0110] S61: Obtain N tea leaves and the corresponding N*(M+1) reflectivities.
[0111] S62: Calculate the correlation coefficients between the target components of the N tea leaves and the corresponding N*(M+1) reflectivities; wherein the target components include moisture content, cellulose content and tea polyphenol content.
[0112] In this example, M = 3, each tea leaf corresponds to 4 reflectances, and N tea leaves correspond to N*4 reflectances. A larger absolute value of the correlation coefficient indicates a stronger correlation between the target component and the reflectance, and thus a better modeling effect. The correlation coefficient can characterize the characteristics of the mesophyll and main veins in each local area of the image, thereby selecting the most representative ROI.
[0113] The step of constructing a reflectivity evaluation model according to the correlation coefficient includes:
[0114] S63: Performing principal component analysis on the hyperspectral image to obtain principal components.
[0115] S64: If the correlation coefficient is greater than the correlation coefficient threshold, a partial least squares regression estimation model is constructed between the principal component and the target component.
[0116] The main idea of principal component analysis is to project the original high-dimensional feature space into a new low-dimensional feature space through linear transformation, while trying to maintain the variance of the original data so that the differences of the data can be retained in the new low-dimensional space.
[0117] Since there are multiple target components and a large number of hyperspectral images, directly building a partial least squares regression estimation model for each hyperspectral image and each target component would result in a large amount of data and low computational efficiency. Performing principal component analysis on hyperspectral images can reduce the amount of data and improve computational speed.
[0118] The method of selecting the optimal reflectivity and the corresponding final ROI area using the reflectivity evaluation model includes:
[0119] S71: Modeling determination coefficient R 2 The partial least squares regression estimation model is evaluated to obtain a first score.
[0120] S72: Use relative analytical error (RPD) to evaluate the partial least squares regression estimation model to obtain a second score.
[0121] S73: Use the normalized root mean square error NRMSE to evaluate the partial least squares regression estimation model to obtain a third score.
[0122] S74: Calculate a comprehensive score based on the first score, the second score, and the third score.
[0123] S75: taking the reflected ROI region corresponding to the maximum value of the comprehensive score as the final ROI region.
[0124] The model determination coefficient R 2 , relative analysis error RPD and normalized root mean square error NRMSE comprehensively evaluate multiple partial least squares regression estimation models, including a total of partial least squares regression estimation models between N target components of tea leaves and corresponding M+1 reflectances.
[0125] Modeling determination coefficient R 2 It has the following advantages: (1) Modeling determination coefficient R 2It is a relative value between [0,1], which overcomes the disadvantage of the MSE (mean-square error) method that has no upper bound. (2) Modeling determination coefficient R 2 It is a relative value, the modeling determination coefficient R 2 It reflects the proportion of the fitted information to the total information of the sample itself, so the modeling determination coefficient is applicable to different samples and different models.
[0126] RPD is a statistical indicator used to evaluate data consistency. RPD reflects the degree to which the data deviates from the mean, that is, the degree of dispersion of the data.
[0127] The advantage of NRMSE is that it overcomes scale dependence and simplifies the comparison process between different scales or models.
[0128] The model determination coefficient R 2 The weight of the relative analysis error (RPD) is set to 50%, the weight of the normalized root mean square error (NRMSE) is set to 30%, and the weight of the normalized root mean square error (NRMSE) is set to 20%. The weighted summation or AHP (Analytical Hierarchy Process) is used to calculate the comprehensive score T of the partial least squares model. The steps of the AHP (Analytical Hierarchy Process) include: (1) establishing a hierarchical structure model; (2) constructing a comparison matrix; (3) calculating the weight vector and performing a consistency test; (4) calculating the combined weight vector and performing a combined consistency test.
[0129] The maximum value of the comprehensive score is screened out, and the ROI area of the reflectivity corresponding to the maximum value of the comprehensive score is used as the final ROI area. The final ROI area is used to characterize the area with the most concentrated moisture content, cellulose content or tea polyphenols content.
[0130] This embodiment combines the modeling determination coefficient R 2 The partial least squares regression estimation model was evaluated using the relative analytical deviation (RPD), and the normalized root mean square error (NRMSE), yielding three scores. A weighted sum or AHP analysis was performed on the three scores to yield a composite score. A higher composite score indicates a more accurate correlation estimated by the partial least squares regression estimation model. The reflected ROI corresponding to the maximum composite score was used as the final ROI, which characterizes the region with the highest concentration of moisture, cellulose, or tea polyphenols.
[0131] Example 3
[0132] A computer device is also provided in an embodiment of the present application. The computer device may be a server, wherein the computer device includes a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store target word vectors, etc. The network interface of the computer device is used to communicate with an external terminal via a network connection. Furthermore, the above-mentioned computer device may also be provided with an input device and a display screen, etc.
[0133] One embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements a method for selecting a ROI region in a tea hyperspectral image. It is understood that the computer-readable storage medium in this embodiment can be either a volatile or non-volatile readable storage medium.
[0134] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, apparatus, article, or method comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, apparatus, article, or method. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, apparatus, article, or method comprising the element.
[0135] The above description is only a preferred embodiment of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for screening ROI regions of tea hyperspectral images, characterized in that: include: Acquiring a hyperspectral image of tea leaves, and preprocessing the hyperspectral image to obtain a preprocessed image; Performing image segmentation on the preprocessed image to obtain a main vein image and a leaf image; removing the main vein image from the leaf image to obtain a mesophyll image; Extracting a mesophyll ROI matrix from the mesophyll image, and dividing M types of mesophyll ROIs according to the distances between different mesophyll ROI matrices; Calculating the reflectivity of the main vein image and the M-type mesophyll ROI to obtain the M+1-type reflectivity; Calculating the correlation coefficient between the target component of the tea leaves and each of the reflectances, and constructing a reflectance evaluation model based on the correlation coefficients; Select the optimal reflectivity and the corresponding final ROI area using the reflectivity evaluation model; The performing image segmentation on the pre-processed image to obtain a main vein image and a leaf image includes: Inputting the preprocessed image into an image segmentation model for image segmentation to obtain a leaf image; Filtering a plurality of first-category edge pixel points of the leaf from the leaf image; Performing translation cutting on the leaf image according to the coordinates of the first type of edge pixel points to obtain a plurality of main vein regions; A plurality of the main vein regions are combined to obtain a main vein image.
2. The method for screening ROI regions of tea leaf hyperspectral images according to claim 1, characterized in that: The leaf image is translated and cut according to the coordinates of the first type of edge pixel points to obtain a plurality of main vein regions, including: Selecting a starting point from the first type of edge pixel points; wherein the first type of edge pixel points correspond to the edge of the tea leaf; Draw a detection frame with the starting point as the center; The detection frame is translated to cut the leaf image until the entire leaf area is traversed to obtain multiple detection frame images; Extracting an image edge from each of the detection frame images, removing the first type of edge pixel points from the image edge, and obtaining a second type of edge pixel points; The second-category edge pixel points belonging to the same detection frame image are connected to obtain a plurality of main vein regions.
3. The method for screening ROI regions of tea hyperspectral images according to claim 1, characterized in that: The method of dividing M types of mesophyll ROIs according to the distances between different mesophyll ROI matrices includes: The KNN clustering algorithm is used to cluster the Euclidean distances between different mesophyll ROI matrices to obtain M types of mesophyll ROIs.
4. The method for screening ROI regions of tea leaf hyperspectral images according to claim 1, characterized in that: The calculating the reflectivity of the main vein image and the M-type mesophyll ROI to obtain the M+1-type reflectivity includes: Obtaining P main vein images, and calculating the first type reflectivity of the P main vein images; Screening out K first-category reflectances with the highest similarity from the P main vein images, calculating the average of the K first-category reflectances with the highest similarity to obtain the reflectance of the main vein image; Obtain P i-th mesophyll ROIs, and calculate the second-category reflectance of the P i-th mesophyll ROIs; K reflectances of the second category with the highest similarity are screened out from P i-th mesophyll ROIs, and the mean of the K reflectances of the second category with the highest similarity is calculated to obtain the reflectance of the i-th mesophyll ROI; wherein 1≤i≤M.
5. The method for screening ROI regions of tea hyperspectral images according to claim 1, characterized in that: The calculating of the correlation coefficient between the target component of the tea leaves and each of the reflectances comprises: Get N tea leaves and corresponding The reflectivity; Calculate the target components of N tea leaves and the corresponding The correlation coefficient between the reflectivities is calculated; wherein the target components include moisture content, cellulose content and tea polyphenol content.
6. The method for screening ROI regions of tea leaf hyperspectral images according to claim 1, characterized in that: The preprocessing of the hyperspectral image to obtain a preprocessed image includes: Performing black-white correction on the hyperspectral image to obtain a black-white corrected image; Performing grayscale conversion on the black-and-white corrected image to obtain a grayscale image; Perform guided filtering on the grayscale image to obtain a preprocessed image.
7. The method for screening ROI regions of tea leaf hyperspectral images according to claim 1, characterized in that: The step of constructing a reflectivity evaluation model according to the correlation coefficient includes: Performing principal component analysis on the hyperspectral image to obtain principal components; If the correlation coefficient is greater than the correlation coefficient threshold, a partial least squares regression estimation model between the principal component and the target component is constructed.
8. The method for screening ROI regions of tea leaf hyperspectral images according to claim 7, characterized in that: The method of selecting the optimal reflectivity and the corresponding final ROI area using the reflectivity evaluation model includes: The model determination coefficient R 2 evaluating the partial least squares regression estimation model to obtain a first score; The relative analytical error (RPD) is used to evaluate the partial least squares regression estimation model to obtain a second score; The normalized root mean square error (NRMSE) is used to evaluate the partial least squares regression estimation model to obtain a third score; Calculating a comprehensive score based on the first score, the second score, and the third score; The reflected ROI region corresponding to the maximum value of the comprehensive score is used as the final ROI region.
9. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method for screening ROI areas of tea hyperspectral images according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Fresh tea leaf classification method based on multiple features and multiple classifiers
CN111861103A
Ground-air spectrum technology combined tea bud yield monitoring method
CN118552870A