On-line detection method of sorghum cooking degree
Through the online detection method, image processing and fitting equations are used to calculate the cooking degree of sorghum, which solves the problem of low efficiency and accuracy of manual detection and improves the efficiency and quality of liquor production.
Patent Information
- Application Number
- CN202211172331.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-09-26
AI Technical Summary
In the existing technology, the detection of the cooking degree of sorghum relies on manual regular or scheduled monitoring, which results in low efficiency and reduced accuracy. It is impossible to accurately judge the cooking degree of sorghum in real time, which affects the liquor yield and quality of liquor.
Using the online detection method of sorghum cooking degree, the cooking degree of sorghum is calculated in real time by collecting cooking images, performing preprocessing and feature extraction, and establishing a fitting equation between moisture content and overall characteristics and a fitting equation between crack rate and overall characteristics.
It achieves accurate online detection of sorghum cooking degree, reduces liquor production costs, improves production efficiency, and promotes liquor yield and quality.
Smart Images

Figure CN115561206B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of detection and analysis, and in particular to an online detection method for sorghum cooking degree. Background Art
[0002] During the liquor brewing process, people pay less attention to sorghum cooking. The changes in sorghum during cooking play a very important role in the liquor quality and yield, and the degree of sorghum cooking has an important influence on the production of Xiaoqu-fragrance liquor.
[0003] At present, in the production process of liquor, the detection of sorghum cooking degree is mainly achieved by manual regular or timed monitoring. Relying on manual labor not only consumes high costs, but also has the problem of low efficiency in sorghum cooking degree detection. At the same time, due to manual operating errors or recording errors, the accuracy of sorghum cooking degree detection will be greatly reduced.
[0004] Therefore, a method for online detection of sorghum cooking degree is needed to solve the above problems. Summary of the invention
[0005] In view of this, the purpose of the present invention is to overcome the defects in the prior art and provide an online detection method for the cooking degree of sorghum, which can make an accurate judgment on the cooking degree of sorghum and realize the online detection of the cooking degree of sorghum.
[0006] The method for online detection of sorghum cooking degree of the present invention comprises the following steps:
[0007] S1. Collecting the cooking image of sorghum for experiment and using the cooking image of sorghum for experiment as the sample image;
[0008] S2. Preprocessing the sample image to obtain a preprocessed sample image;
[0009] S3. extracting the overall features of the preprocessed sample image;
[0010] S4. The moisture content and crack rate of the experimental sorghum are obtained, and the moisture content and the overall characteristics are fitted to obtain a fitting equation A of the moisture content and the overall characteristics; the crack rate and the overall characteristics are fitted to obtain a fitting equation B of the crack rate and the overall characteristics;
[0011] S5. Substituting the overall characteristics of the cooking image of the sorghum to be tested into the fitting equation A to obtain the moisture content of the sorghum to be tested; substituting the overall characteristics of the cooking image of the sorghum to be tested into the fitting equation B to obtain the crack rate of the sorghum to be tested;
[0012] S6. Determine the cooking degree of the sorghum to be tested according to the moisture content and crack rate of the sorghum to be tested.
[0013] Further, the sample image is preprocessed to obtain a preprocessed sample image, which specifically includes:
[0014] S21. grayscale the sample image to obtain a grayscale image;
[0015] S22. Divide the grayscale image according to the set grayscale threshold to obtain two types of image areas;
[0016] S23. Using the image area with a smaller grayscale level in the two types of image areas as the foreground of the grayscale image, and using the image area with a larger grayscale level in the two types of image areas as the background of the grayscale image;
[0017] S24. Perform noise filtering on the grayscale image processed in step S23 to obtain a denoised image;
[0018] S25. Perform edge extraction on the denoised image, and perform edge detection and edge connection on the edge-extracted image to obtain a preprocessed sample image.
[0019] Further, the grayscale threshold is determined according to the following method:
[0020] a. Construct grayscale threshold setting model:
[0021]
[0022] in, p i =n i / N, i = 0, 1, 2 ... L-1; L-1 is the maximum grayscale value of the grayscale image, and n i represents the number of pixels with grayscale i, N is the total number of grayscale image pixels; T is the grayscale threshold;
[0023] b. Adjust the parameter values in the grayscale threshold setting model so that the grayscale threshold setting model obtains a maximum value, and the grayscale threshold set when the model obtains the maximum value is used as the set grayscale threshold.
[0024] Furthermore, the overall features of the preprocessed sample image are extracted, specifically including:
[0025] S31. Divide the preprocessed sample image into several sub-images;
[0026] S32. Extracting overall features of the plurality of sub-images respectively; wherein the overall features include sorghum grain color, sorghum grain volume and sorghum grain texture.
[0027] Furthermore, the water content and the overall characteristics are fitted to obtain the fitting equation A of the water content and the overall characteristics, which specifically includes:
[0028] The sorghum moisture content corresponding to several sub-images is taken as the dependent variable set Y A , the overall features corresponding to several sub-images are taken as the independent variable set X A ;
[0029] The dependent variable set Y A With the independent variable set X A The data were fitted to obtain the fitting equation A.
[0030] Furthermore, the crack rate and the overall characteristics are fitted to obtain the fitting equation B of the crack rate and the overall characteristics, which specifically includes:
[0031] The sorghum crack rates corresponding to several sub-images are taken as the dependent variable set Y B , the overall features corresponding to several sub-images are taken as the independent variable set X B ;
[0032] The dependent variable set Y B With the independent variable set X B The data were fitted to obtain the fitting equation B.
[0033] Further, the fitting equation A is determined according to the following formula:
[0034] Y1=a0+a1x1+a2x2+…+a n x n +ε1;
[0035] Among them, Y1 is the water content; a0,…,a n represents n equation coefficients; x1,…,x n Represents n features in the overall features; ε1 is the correction coefficient.
[0036] Further, the fitting equation B is determined according to the following formula:
[0037] Y2=b0+b1x1+b2x2+…+b n x n +ε2;
[0038] Among them, Y2 is the crack rate; b0,…,b n represents n equation coefficients; x1,…,x n Represents n features in the overall features; ε2 is the correction coefficient.
[0039] The beneficial effects of the present invention are as follows: the present invention discloses an online detection method for the cooking degree of sorghum, which collects images of sorghum during the cooking process, and performs correlation analysis on characteristic indicators of sorghum with water content and crack rate, thereby obtaining a calculation equation for the water content and crack rate of sorghum. With the aid of the calculation equation, the online detection of the cooking degree of sorghum is realized, and the cooking degree of sorghum can be accurately judged, which has a promoting effect on the yield and quality of liquor, reduces the cost in liquor production, and improves the efficiency of liquor production. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:
[0041] Figure 1 It is a schematic diagram of the method flow of the present invention;
[0042] Figure 2 It is a structural schematic diagram of the photographing device of the present invention;
[0043] Figure 3 It is a schematic diagram of image data processing of the present invention;
[0044] Figure 4 It is a schematic diagram of the detection and analysis implementation process of the present invention;
[0045] Among them, 1-camera fixture, 2-color CCD camera, 3-annular light source frame, 4-light source frame fixture, 5-camera bracket. DETAILED DESCRIPTION
[0046] The present invention is further described below in conjunction with the accompanying drawings, as shown in the drawings:
[0047] The method for online detection of sorghum cooking degree of the present invention comprises the following steps:
[0048] S1. Collecting the cooking image of sorghum for experiment and using the cooking image of sorghum for experiment as the sample image;
[0049] S2. Preprocessing the sample image to obtain a preprocessed sample image;
[0050] S3. extracting the overall features of the preprocessed sample image;
[0051] S4. The moisture content and crack rate of the experimental sorghum are obtained, and the moisture content and the overall characteristics are fitted to obtain a fitting equation A of the moisture content and the overall characteristics; the crack rate and the overall characteristics are fitted to obtain a fitting equation B of the crack rate and the overall characteristics;
[0052] S5. Substituting the overall characteristics of the cooking image of the sorghum to be tested into the fitting equation A to obtain the moisture content of the sorghum to be tested; substituting the overall characteristics of the cooking image of the sorghum to be tested into the fitting equation B to obtain the crack rate of the sorghum to be tested;
[0053] S6. Determine the cooking degree of the sorghum to be tested according to the moisture content and crack rate of the sorghum to be tested.
[0054] In this embodiment, in step S1, a cooking image of the experimental sorghum is collected by a photographing device; Figure 2 As shown, the shooting device includes a color CCD camera 2, a camera bracket 5, a camera fixture 1, an annular light source frame 3 and a light source frame fixture 4; the color CCD camera 2 is fixed by the camera fixture 1, and the annular light source frame 3 is fixed by the light source frame fixture 4. The color CCD camera 2 and the annular light source frame 3 are then installed on the camera bracket 5 together; by adjusting the positions of the camera fixture 1 and the light source frame fixture 4 on the camera bracket 5, the color CCD camera 2 can shoot the sorghum cooking condition in the cooking pot with a perspective window on the side with the help of the illumination of the annular light source frame 3, thereby obtaining sorghum cooking pictures with different gradients.
[0055] In this embodiment, preprocessing the sample image to obtain the preprocessed sample image specifically includes:
[0056] S21. Use MATLAB GUI programming to develop an image processing algorithm. Through the RGB color model transformation, extract the red channel mean (R), green channel mean (G), and blue channel mean (B) of the sample image, a total of three color feature variables; use the weighted mean method to obtain the average value of the three components of red, green, and blue according to certain weights as the grayscale value. The weighted grayscale processing process is as follows:
[0057] f=(W r R+W g G+W b B) / 3;
[0058] Where, f represents the grayscale image; W r =0.2990,W g =0.5870,W b =0.1140 to obtain a grayscale image that conforms to the characteristics of the human eye.
[0059] S22. Divide the pixels in the grayscale image into two image regions C0 and C1 according to the set grayscale threshold T0, where C0 consists of pixels with grayscale values between [0, T0] and C1 consists of pixels with grayscale values between [T0+1, L-1];
[0060] S23. The image area with a smaller grayscale level in the two types of image areas is used as the foreground of the grayscale image, and the image area with a larger grayscale level in the two types of image areas is used as the background of the grayscale image. In this embodiment, C0 is used as the target area, that is, the foreground; C1 is used as the non-target area, that is, the background.
[0061] S24. Perform noise filtering on the grayscale image processed in step S23 to obtain a denoised image; wherein, Gaussian filtering is used to perform noise processing on the grayscale image to remove noise that conforms to the normal distribution, which has a good effect, makes the image smooth, and can retain image detail information. According to the selected fixed window size and the distance between any pixel in the window and the central pixel point, the Gaussian function is used to realize the allocation of coefficient weights. The Gaussian filtering adopts the existing technology and will not be repeated here.
[0062] S25. Perform edge extraction on the denoised image, and perform edge detection and edge connection on the edge-extracted image to obtain a preprocessed sample image. The Canny operator is used to extract the edges of the denoised image to retain the desired edges. The amplitude and direction of the gradient of the denoised image are calculated using the finite difference of the first-order partial derivative. Since the edges extracted based on the gradient amplitude are still relatively fuzzy, the gradient amplitude needs to be processed with non-maximum limit. After processing, a dual threshold algorithm is used to detect edges and connect edges, thereby completing the processing of the entire image.
[0063] In this embodiment, the grayscale threshold is determined according to the following method:
[0064] a. Construct grayscale threshold setting model:
[0065]
[0066] in, p i =n i / N, i = 0, 1, 2 ... L-1; L-1 is the maximum grayscale value of the grayscale image, and n i represents the number of pixels with grayscale i, N is the total number of grayscale image pixels; T is the grayscale threshold;
[0067] b. Adjust the parameter values in the grayscale threshold setting model so that the grayscale threshold setting model obtains a maximum value, and the grayscale threshold set when the model obtains the maximum value is used as the set grayscale threshold.
[0068] In this embodiment, in step S3, extracting the overall features of the preprocessed sample image specifically includes:
[0069] S31. Divide the preprocessed sample image into several sub-images;
[0070] S32. Extracting overall features of the plurality of sub-images respectively; wherein the overall features include sorghum grain color, sorghum grain volume and sorghum grain texture.
[0071] In this embodiment, in step S4, the moisture content of sorghum during the cooking process can be measured by a moisture measuring instrument, and the crack rate of sorghum can be calculated by statistical sampling of cracks in sorghum grains. For example, if 85 of 100 grains are cracked, the crack rate is 85%.
[0072] The water content and the overall characteristics are fitted to obtain the fitting equation A of the water content and the overall characteristics, which specifically includes:
[0073] The sorghum moisture content corresponding to several sub-images is taken as the dependent variable set Y A , the overall features corresponding to several sub-images are taken as the independent variable set X A ; Among them, the sorghum part corresponding to the sub-image is taken as the target sorghum, and the moisture content of the target sorghum obtained by measurement is taken as the dependent variable, and the dependent variable set Y is composed of several dependent variables A ; By extracting the overall features of the target sorghum, the overall features corresponding to the sub-image are obtained;
[0074] The dependent variable set Y A With the independent variable set X A Data fitting is performed to obtain a fitting equation A. The water content and overall characteristics corresponding to each sub-image form a set of fitting data pairs, and several sub-images form several sets of fitting data pairs. The several sets of fitting data pairs are essentially several pairs (x, y) of the fitting equation. Through several pairs (x, y), multiple unknown coefficients of the fitting equation can be determined, thereby obtaining the fitting equation.
[0075] In this embodiment, the principle of obtaining the fitting equation A is the same as that of the above, and the data fitting of the crack rate and the overall characteristics is performed to obtain the fitting equation B of the crack rate and the overall characteristics, which specifically includes:
[0076] The sorghum crack rates corresponding to several sub-images are taken as the dependent variable set Y B , the overall features corresponding to several sub-images are taken as the independent variable set X B ;
[0077] The dependent variable set Y B With the independent variable set X B The data were fitted to obtain the fitting equation B.
[0078] By using numerical analysis to carry out correlation analysis between characteristic indicators and moisture content and crack rate, the regression equations of cooking degree were constructed: Equation A and Equation B.
[0079] In this embodiment, the sorghum grain color in the overall characteristics includes a red channel value (R), a green channel value (G), a blue channel value (B), a hue mean value (H), a saturation mean value (S), and a brightness mean value (L);
[0080] The sorghum grain volume in the overall characteristics includes the ratio of the major axis to the minor axis of the grain region (e) and the grain swelling degree (J) calculated based on the grain boundary extraction;
[0081] The sorghum grain texture in the overall features includes the average gray value (m), standard deviation (δ), and smoothness (r) calculated based on the statistical properties of the gray histogram.
[0082] Through the above analysis, the overall characteristics include 11 characteristic variables.
[0083] In this embodiment, the fitting equation A is determined according to the following formula:
[0084] Y1=a0+a1x1+a2x2+…+a n x n +ε1;
[0085] Among them, Y1 is the water content; a0,…,a n represents n equation coefficients; x1,…,x n Represents n features in the overall features; ε1 is the correction coefficient.
[0086] The fitting equation B is determined according to the following formula:
[0087] Y2=b0+b1x1+b2x2+…+b n x n +ε2;
[0088] Among them, Y2 is the crack rate; b0,…,b n represents n equation coefficients; x1,…,x n Represents n features in the overall features; ε2 is the correction coefficient.
[0089] In the fitting equation A and the fitting equation B, the value of n is a positive integer not exceeding 11. Specifically, according to the degree of influence of the characteristic variables on the water content and the crack rate, characteristic variables with a large influence less than 11 can be selected as independent variables in the fitting equation; at the same time, the correction coefficient in the fitting equation A and the fitting equation B is not necessary, but due to the error between the theoretical analysis and the actual situation, the error of the fitting equation is reduced as much as possible by adding the correction coefficient; the size of the correction coefficient can be determined according to the actual working conditions.
[0090] In this embodiment, in step S5, the cooking image of the sorghum to be tested can be divided into several parts, and the overall characteristics of the several parts of the image can be substituted into the fitting equation A respectively to obtain several parts of moisture content; similarly, the overall characteristics of the several parts of the image can be substituted into the fitting equation B to obtain several parts of crack rate; of course, the cooking image of the sorghum to be tested can also be not divided, but the moisture content and crack rate can be directly calculated.
[0091] In step S6, according to the sorghum cooking degree evaluation standard, the water content and crack rate of the sorghum corresponding to each image are analyzed respectively, and the cooking degree of the sorghum corresponding to each image is determined, and several cooking degree values can be obtained, and the average value of the several cooking degree values is taken as the cooking degree of the sorghum to be tested. The cooking degree includes seven-tenths done, seven-tenths done, eight-tenths done, eight-tenths done, etc.; by quantifying and normalizing the cooking degree, the cooking degree value can be obtained, for example, seven-tenths done is 0.7, and seven-tenths done is 0.75.
[0092] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
Claims
1. A method for online detection of sorghum cooking degree, characterized in that: The steps include: S1. Collecting the cooking image of sorghum for experiment and using the cooking image of sorghum for experiment as the sample image; S2. Preprocessing the sample image to obtain a preprocessed sample image; S3. Extract the overall features of the preprocessed sample image, specifically including: S31. Divide the preprocessed sample image into several sub-images; S32. Extracting overall features of several sub-images respectively; wherein the overall features include sorghum grain color, sorghum grain volume and sorghum grain texture; S4. The moisture content and crack rate of the experimental sorghum are obtained, and the moisture content and the overall characteristics are fitted to obtain a fitting equation A of the moisture content and the overall characteristics; the crack rate and the overall characteristics are fitted to obtain a fitting equation B of the crack rate and the overall characteristics; The water content and the overall characteristics are fitted to obtain the fitting equation A of the water content and the overall characteristics, which specifically includes: The sorghum moisture content corresponding to several sub-images is taken as the dependent variable set Y A , the overall features corresponding to several sub-images are taken as the independent variable set X A ; The dependent variable set Y A With the independent variable set X A Perform data fitting to obtain fitting equation A; The crack rate and the overall characteristics are fitted to obtain the fitting equation B of the crack rate and the overall characteristics, which specifically includes: The sorghum crack rates corresponding to several sub-images are taken as the dependent variable set Y B , the overall features corresponding to several sub-images are taken as the independent variable set X B ; The dependent variable set Y B With the independent variable set X B Perform data fitting to obtain fitting equation B; The sorghum grain color in the overall characteristics includes red channel value (R), green channel value (G), blue channel value (B), hue mean value (H), saturation mean value (S), and brightness mean value (L); The sorghum grain volume in the overall characteristics includes the ratio of the major axis to the minor axis of the grain region (e) and the grain swelling degree (J) calculated based on the grain boundary extraction; The sorghum grain texture in the overall features includes the average gray value (m), standard deviation (δ), and smoothness (r) calculated based on the statistical attributes of the gray histogram; S5. Substituting the overall characteristics of the cooking image of the sorghum to be tested into the fitting equation A to obtain the moisture content of the sorghum to be tested; substituting the overall characteristics of the cooking image of the sorghum to be tested into the fitting equation B to obtain the crack rate of the sorghum to be tested; S6. Determine the cooking degree of the sorghum to be tested according to the moisture content and crack rate of the sorghum to be tested.
2. The method for online detection of sorghum cooking degree according to claim 1, characterized in that: Preprocessing the sample image to obtain a preprocessed sample image specifically includes: S21. grayscale the sample image to obtain a grayscale image; S22. Divide the grayscale image according to the set grayscale threshold to obtain two types of image areas; S23. Using the image area with a smaller grayscale level in the two types of image areas as the foreground of the grayscale image, and using the image area with a larger grayscale level in the two types of image areas as the background of the grayscale image; S24. Perform noise filtering on the grayscale image processed in step S23 to obtain a denoised image; S25. Perform edge extraction on the denoised image, and perform edge detection and edge connection on the edge-extracted image to obtain a preprocessed sample image.
3. The method for online detection of sorghum cooking degree according to claim 2, characterized in that: The grayscale threshold is determined as follows: a. Build a grayscale threshold setting model: in, p i =n i / N, i = 0, 1, 2 ... L-1; L-1 is the maximum grayscale value of the grayscale image, and n i represents the number of pixels with grayscale i, N is the total number of grayscale image pixels; T is the grayscale threshold; b. Adjust the parameter values in the grayscale threshold setting model so that the grayscale threshold setting model obtains a maximum value, and the grayscale threshold set when the model obtains the maximum value is used as the set grayscale threshold.
4. The method for online detection of sorghum cooking degree according to claim 1, characterized in that: The fitting equation A is determined according to the following formula: Y1=a0+a1x1+a2x2+…+a n x n +ε1; Among them, Y1 is the water content; a0,…,a n represents n equation coefficients; x1,…,x n Represents n features in the overall features; ε1 is the correction coefficient.
5. The method for online detection of sorghum cooking degree according to claim 1, characterized in that: The fitting equation B is determined according to the following formula: Y2=b0+b1x1+b2x2+…+b n x n +ε2; Among them, Y2 is the crack rate; b0,…,b n represents n equation coefficients; x1,…,x n Represents n features in the overall features; ε2 is the correction coefficient.
