Method for rapidly judging black soil layer based on digital image processing

Through digital image processing and machine learning algorithms, the quantitative relationship between soil color parameters and black soil layer determination rules is constructed, which solves the problems of low efficiency and poor accuracy of black soil layer determination in the existing technology, and realizes the black soil layer and non-black soil layer Quick and accurate judgment.

CN119418094APending Publication Date: 2025-02-11INST OF SOIL SCI CHINESE ACAD OF SCI
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411378946.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

It is difficult for the prior art to quickly and accurately determine the thickness of the black soil layer. The traditional methods are inefficient, rely on expert experience and are subjective. The scope of application of geophysical methods is limited and the results need to be verified.

Method used

Using digital image processing technology and machine learning algorithms, the quantitative relationship between soil color parameters and black soil layer judgment rules is established to realize the black soil layer by collecting soil profile images, color correction, extracting feature classification variables, and constructing black soil layer judgment rules. Binary judgment with non-black soil layer.

Benefits of technology

The rapid binary judgment of the black soil layer and the non-black soil layer is achieved, and the problems of inefficiency of the traditional method and relying on expert experience are overcome. It can be directly used for the rapid batch judgment of the black soil layer in soil profile photos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119418094A_ABST
    Figure CN119418094A_ABST
Patent Text Reader

Abstract

The invention discloses a digital image processing-based black soil layer rapid determination method, which comprises the following steps of S1, collecting a soil profile image, and dividing a soil generation layer in a soil profile into a black soil layer and a non-black soil layer; s2, correcting the color of the soil profile image; s3, extracting feature classification variables; s4, constructing a black soil layer judgment rule; and S5, constructing a black soil layer judgment model by taking the state of the soil profile as a dependent variable and the color parameter as an independent variable. According to the method, the quantitative relation between the soil color parameters and the black soil layer judgment rule is constructed, so that the defects that an original determination method highly depends on expert experience and knowledge and is low in efficiency are overcome, and binary judgment of the black soil layer and the non-black soil layer can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a method for quickly determining a black soil layer based on digital image processing. Background Art

[0002] The black soil layer is one of the essential characteristics of black soil. It has high humus content and base saturation, and well-developed granular structure, which is the key to the high fertility of black soil. At the same time, the thickness of the black soil layer can also reflect the degree of soil development and is also the main indicator for determining the degree of soil erosion. Therefore, the information on the thickness of the black soil layer is of great significance for evaluating the quality of cultivated land and strengthening the utilization and protection of black soil.

[0003] At present, there are relatively few studies on the rapid identification method of black soil layer, which mainly refers to the determination method of soil thickness, that is, the traditional profile survey method (mainly relying on visual and tactile characteristics) and geophysical methods. The traditional methods for determining black soil layer mainly include soil profile method, plugging method, drilling method, penetrometer method, etc. Among them, the soil profile method requires destructive excavation of the sampling point and then makes the judgment based on expert knowledge, so it is difficult, has a long cycle, low efficiency, and has a certain degree of subjectivity; while the plugging method, drilling method and penetrometer method do not require profile excavation, but in the process of obtaining soil samples, the sampling tool needs to be inserted into the soil from top to bottom, so some soil samples will be compacted and mixed together, affecting the results of the judgment. The geophysical method is an indirect measurement method, focusing on the use of conductivity meters, ground penetrating radars, electrical resistance imagers and shallow seismic diffractometers to detect soil structures. Although compared with traditional methods, geophysical methods do not require destructive sampling of the soil and have advantages in time efficiency and spatial scale, their scope of application is relatively limited, they have regional characteristics, and the detection results still need to be verified by direct detection methods.

[0004] Compared with expensive and bulky sensors, although digital cameras have relatively low measurement accuracy and are easily affected by the sampling environment, they are cheap, portable, easy to operate, and have more flexible requirements for the shooting environment. They can easily obtain morphological information such as soil surface color and texture. They have been widely used in the inversion of soil organic matter, moisture, nitrogen, cation exchange capacity, pH, Fe, salt content, gravel content and distribution, and have achieved certain results. Therefore, many scholars have tried to classify soil layers through digital image technology. However, black soil has high organic matter content, heavy texture, high base saturation, and different black soil properties in different regions; the soil profile photos accumulated in historical soil surveys contain accurate soil stratification information, but there is no effective data analysis method to use it to determine the black soil layer. Therefore, the original digital soil image processing technology is difficult to be directly applied to black soil areas, and cannot be directly used to determine the thickness of the black soil layer. Summary of the invention

[0005] Purpose of the invention: The purpose of the present invention is to provide a method for rapid determination of black soil layer based on digital image processing, establish knowledge rules for determining black soil layer, construct a quantitative relationship between soil color parameters and black soil layer determination rules to realize binary determination of black soil layer and non-black soil layer.

[0006] Technical solution: A method for quickly determining the black soil layer based on digital image processing, comprising the following steps:

[0007] S1, collecting soil profile images and dividing the soil layers in the soil profile into black soil layers and non-black soil layers;

[0008] S2, color correction of soil profile image;

[0009] S3, extracting characteristic categorical variables;

[0010] S4, construct the black soil layer determination rule;

[0011] S5, with the state of soil profile as the dependent variable and color parameters as the independent variable, a black soil layer determination model was constructed.

[0012] Furthermore, the method for collecting soil profile images is as follows: the camera lens is placed parallel to the profile at a distance of 1.5 meters, so that the entire profile is located in the central area of ​​the image, and the camera parameters are automatically set.

[0013] Further, in step S2, a white area with the highest brightness in the profile scale is selected and regarded as a whiteboard. The statistical average values ​​of the three channels of R, G, and B in the area are considered to be equal. This is used as a basis for correction. According to the deviation between the RGB value of the pixel and the zero value corresponding to pure white (R, G, and B values ​​are all 255), the entire image is corrected according to the corresponding ratio calculation;

[0014] According to the deviation between the RGB value of the pixel and the zero value corresponding to the white board, the perfect reflection method is used to perform color correction on the entire image. The detailed steps are as follows:

[0015] S21, traverse each pixel point in the cross-sectional image, calculate the sum of the R+G+B pixels of each pixel point, and find the brightest point in the image and save it;

[0016] S22, calculating the threshold T of the first 10% reference points according to the sum of the pixels;

[0017] S23, traverse each pixel point in the cross-sectional image again, and calculate the cumulative sum and mean of the R, G, and B components of all points where R+G+B is greater than T;

[0018] S24, calculating the gain coefficient of each channel of the image according to the value of the brightest point and the mean values ​​of R, G, and B;

[0019] S25, processing each channel of each pixel of the image according to the gain coefficient, while ensuring that the quantized R, G, and B values ​​are within the range of [0,255].

[0020] Furthermore, in step S3, the boundary of the black soil layer is determined based on the boundary and thickness of the soil genetic layer; in each soil genetic layer, a representative area is selected as the region of interest, and the color parameters of the region of interest are extracted as classification feature variables.

[0021] Further, in step S4, the black soil layer is identified and delineated for each profile, and for all profile image samples, the soil genesis layer is divided into a black soil layer and a non-black soil layer according to the quantitative rule for determining the black soil layer;

[0022] The quantitative rules for determining the black soil layer are formulated as follows:

[0023] Under moist soil conditions, chroma ≤3 and lightness ≤3; under dry conditions, lightness ≤5;

[0024] Organic carbon content ≥12g / kg and ≤200g / kg.

[0025] Further, in step S5, the implementation steps of constructing the black soil layer determination model are as follows:

[0026] S51, randomly divide the soil sample data of the field "Whether it is a black soil layer" into a training set and a validation set in a ratio of 7:3;

[0027] S52, set the black soil layer to 1 and the non-black soil layer to 0 as the dependent variable; use the color parameter as the independent variable to build the RF machine learning classification model;

[0028] S53, perform 50 independent iterations on the RF machine learning classification model, and output the model evaluation and prediction results respectively; after verification, select the model with the highest classification accuracy and save it as the black soil layer determination model.

[0029] Furthermore, the color parameters include sRGB color space, sRGB color space inverse, sRGB color space logarithm, super red, sRGB color space band operation, Lab color model, Luv color model and CIEXYZ color space.

[0030] Further, in step S53, the detailed steps of selecting the model with the highest classification accuracy are as follows:

[0031] S531, 50 independent iterations of the RF model;

[0032] S532, verify and evaluate the classification accuracy of the RF model, select the RF model with the highest classification accuracy and save it; the classification accuracy uses the Kappa coefficient.

[0033] Compared with the prior art, the present invention has the following significant effects:

[0034] The present invention adopts digital image processing technology and machine learning algorithm to establish black soil layer discrimination rules, decompose soil color parameters, and construct a quantitative relationship between soil color parameters and black soil layer discrimination rules, thereby overcoming the shortcomings of the original determination methods at home and abroad that are highly dependent on expert experience and knowledge and inefficient, and realizing binary discrimination between black soil layer and non-black soil layer; and after calibration, the constructed method can be directly used for rapid batch discrimination of black soil layers in soil profile photos. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is the overall flow chart of the present invention;

[0036] Figure 2(a) is the original image, Figure 2(b) is the color corrected image, and Figure 2(c) is a schematic diagram of the region of interest;

[0037] FIG3(a) is an original image of section No. 22-042 in the embodiment, and FIG3(b) is a schematic diagram of the RF discrimination result of section No. 22-042. DETAILED DESCRIPTION

[0038] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0039] like Figure 1 The flowchart of the method for rapid determination of black soil layer based on digital image processing is shown, and the steps are as follows:

[0040] Step 1, prepare data;

[0041] All typical soil profile descriptions and data recorded in "Chinese Soil System Records·Jilin Volume" (Science Press, 2019) and "Chinese Soil System Records·Heilongjiang Volume" (Science Press, 2020) were selected, and some data with poor exposure conditions and abnormalities were removed, including a total of 116 soil profiles. The 116 soil profiles are divided into 423 layers, including 134 black soil layers and 289 non-black soil layers. For the acquisition of soil profile images, the specific acquisition method is to place the camera lens parallel to the profile at a position about 1.5 meters away, so that the entire profile is located in the central area of ​​the image, and the camera parameters are automatically set. When shooting, avoid the shadows caused by nearby vegetation, terrain, etc., take a photo of the soil profile, and obtain Figure 2(a). The yellow horizontal line in the figure is added later.

[0042] Step 2, color correction of soil profile image;

[0043] Select a white area with the highest brightness in the profile scale as shown in Figure 2(a), and regard it as a white board. The statistical average values ​​of the three channels of R, G, and B in this area are considered equal. This is used as the basis for correction. According to the deviation between the RGB value of the pixel and the zero value corresponding to pure white (i.e., white area), the color correction of the entire image is performed using the perfect reflection method according to a certain ratio. Since the profile scale of each profile image contains a white area, the white area is selected to correct the image to reduce the color distortion caused by different color temperatures (the corrected image is shown in Figure 2(b)).

[0044] The steps for color correction using the perfect reflection method are as follows:

[0045] Step 21, traverse each pixel point in the cross-sectional image, calculate the sum of the R+G+B pixels of each pixel point, and find the brightest point in the image and save it.

[0046] Step 22, calculating the threshold T of the first 10% reference points according to the sum of the pixels.

[0047] Step 23, traverse each pixel point in the cross-sectional image again, and calculate the cumulative sum and mean of the R, G, and B components of all points where R+G+B is greater than T.

[0048] Step 24, calculate the gain coefficient of each channel of the image according to the value of the brightest point and the mean values ​​of R, G, and B calculated in step 23.

[0049] Step 25, according to the gain coefficient, each channel of each pixel of the image is processed, while ensuring that the quantized R, G, and B values ​​are within the range of [0,255].

[0050] Step 3, extraction of feature classification variables;

[0051] According to the boundary and thickness of the soil genetic layer, the boundary of the black soil layer is determined (for example, the black soil layer is above 40 cm in Figure 2 (a), and the non-black soil layer is below 40 cm). The soil profile image is manually divided into regions of interest layer by layer, and the regions of interest of each layer are obtained as shown in Figure 2 (c). Due to the focusing effect of the convex lens inside the digital camera, the photos taken have the characteristics of bright middle and dark edges. Therefore, the region of interest is selected as close to the middle of the image as possible, and the genetic layer at the bottom of the image edge with poor exposure conditions is discarded. At the same time, the shadows caused by uneven trimming of the profile and the disturbed areas such as roots and intrusive bodies are avoided.

[0052] In each soil layer, a representative area is selected as the region of interest. The color parameters of the region of interest are extracted as classification feature variables. The types of color parameters are shown in Table 1.

[0053] Table 1 Classification characteristic variable table

[0054]

[0055] Step 4, constructing black soil layer determination rules;

[0056] Referring to the rules for determining the black soil layer at home and abroad, the quantitative rules for determining the black soil layer are formulated as follows:

[0057] 1) Under moist soil conditions, chroma ≤3 and lightness ≤3; under dry soil conditions, lightness ≤5;

[0058] 2) Organic carbon content ≥12g / kg (≥6g / kg in tropical areas) and ≤200g / kg.

[0059] In this embodiment, the black soil layer is identified and delineated for each profile, and the soil layers of all profile samples are divided into two categories: black soil layer and non-black soil layer. As shown in Figure 3(a), the Ah and AB layers are black soil layers, and the BC, Crq1, and Crq2 layers are non-black soil layers.

[0060] Step 5, using the random forest (RF) model in R language to build a black soil layer determination model;

[0061] Use the caret package to build; the steps for RF classification using the caret package in R language are as follows:

[0062] Step B1, load the package and sample dataset;

[0063] Type the following code in the R language console:

[0064] library(randomForest)#Load RF package

[0065] library(caret)#Load the caret package

[0066] library(bsoil)#Load the black soil dataset

[0067] Step B2, data segmentation;

[0068] Type the following code in the R language console:

[0069] indexes = createDataPartition(bsoil$blayer, p = .70, list = FALSE) #Use the data partitioning function "createDataPartition" to randomly split the target field "blayer" in the data set bsoil into two parts, 70% of which is the training set and the remaining 30% is the validation set. "list = FALSE" means that the data is not stored in a list.

[0070] train=bsoil[indexes,]#The training set is the indexes data subset separated

[0071] test=bsoil[-indexes,]#The validation set is the data subset consisting of other data except indexes. Step B3, parameter setting of classification model;

[0072] Type the following code in the R language console:

[0073] tc=trainControl(method="repeatedcv",number=10,repeats=50)#Use the parameter control function "trainControl" to set the parameters of the model, where method="repeatedcv" means the k-fold cross-validation method is used, number=10 means the value of k in the cross-validation method, and repeats=50 means the number of iterations.

[0074] Step B4, training of classification model;

[0075] Type the following code in the R language console:

[0076] cmodel=train(blayer~.,data=train,method="rf",trControl=tc)#Use the "train" function to build a classification model, where the dependent variable is "blayer" (black soil layer or non-black soil layer), the independent variables are other variables (color parameters) except "blayer", the training data "data" used is the train data set in the previous text, the modeling method method is the random forest model rf, and the model parameter trControl called is the tc parameter constructed in step B3.

[0077] Step B5, calculation of classification feature contribution;

[0078] Type the following code in the R language console:

[0079] var_imp<-varImp(cmodel)#Use the variable importance calculation function "varImp" to calculate variable importance.

[0080] Step B6, classification model prediction;

[0081] Type the following code in the R language console:

[0082] cpred = predict(cmodel, test) #Use the prediction function "predict" for classification prediction. The model and validation set used are the "cmodel" model and "test" validation set established above.

[0083] Step B7, calculating the classification prediction confusion matrix to obtain the classification accuracy;

[0084] Type the following code in the R language console:

[0085] cm=confusionMatrix(test$blayer,cpred)#Use the confusion matrix function "confusionMatrix" to calculate the prediction accuracy, and judge the prediction accuracy based on the output accuracy index. In this embodiment, the kappa coefficient is used for judgment.

[0086] The implementation steps of building a black soil layer determination model are as follows:

[0087] Step 51, dividing the sample data;

[0088] The soil sample data of the "Is it a black soil layer" field is divided. In order to obtain the prediction model more accurately and evaluate the model performance more objectively, in this embodiment, the sample data is randomly divided according to a ratio of 7:3, that is, 70% of the samples are randomly selected as the training set for predicting the constructed black soil layer determination model, and the remaining 30% of the samples are used as the verification set to evaluate the performance of the black soil layer determination model.

[0089] Step 52, establishment of quantitative relationship;

[0090] The black soil layer was set to 1 and the non-black soil layer was set to 0 as the dependent variable; all the color parameters in Table 1 in step 3 were used as independent variables; an RF machine learning classification model was constructed to obtain the quantitative relationship between the black soil layer / non-black soil layer and the color parameters.

[0091] Step 53, iteration of the model;

[0092] In order to fully confirm the performance of the random forest (RF) model and the stability of its classification, the model was iterated 50 times independently to evaluate the model and output the prediction results. Before each iteration of the model, the sample data was re-partitioned. After verification, the optimal model was selected and saved as the black soil layer determination model.

[0093] The specific steps are as follows:

[0094] Step 531, performing 50 independent iterations on the RF model;

[0095] Step 532, verify and evaluate the classification accuracy of the RF model, select the RF model with the highest classification accuracy and save it; the classification accuracy uses the Kappa coefficient;

[0096] The Kappa coefficient is an indicator of classification accuracy, which measures the consistency between the classifier's prediction results and the actual observation results. The calculation formula of the Kappa coefficient is as follows:

[0097]

[0098] Among them, p o It is the sum of the number of correctly classified samples of each type of soil layer (black soil layer or non-black soil layer) divided by the total number of samples, that is, the overall classification accuracy; Pe is the accidental consistency error.

[0099] Assume that the number of real samples of each class is a1, a2, ..., a c , and the predicted number of samples of each category are b1, b2, ..., b c , the total number of samples is n, then:

[0100]

[0101] The above two accuracies are used to determine the judgment accuracy of the classifier, and the result with the highest classification accuracy Kappa coefficient is selected as the judgment result to generate a judgment result file.

[0102] As shown in Figure 3(a), it is the original image of the section No. 22-042 in the embodiment, and as shown in Figure 3(b), it is the cross-sectional image of the black soil layer predicted by the random forest (RF) model in Figure 3(a). It can be seen that the present invention can realize the rapid extraction of the boundary information of the black soil layer, and assist the traditional black soil layer identification.

[0103] The present invention can overcome the defect that the traditional method relies on the experience and knowledge of experts to determine the black soil layer, and can realize the rapid determination of the black soil layer based on digital photos with high stability.

Claims

1. A method for rapid determination of black soil layer based on digital image processing, characterized in that: The steps include: S1, collecting soil profile images and dividing the soil layers in the soil profile into black soil layers and non-black soil layers; S2, color correction of soil profile image; S3, extracting characteristic categorical variables; S4, construct the black soil layer determination rule; S5, with the state of soil profile as the dependent variable and color parameters as the independent variable, a black soil layer determination model was constructed.

2. The method for rapid determination of black soil layer based on digital image processing according to claim 1 is characterized in that: The method for collecting soil profile images is as follows: place the camera lens parallel to the profile at a distance of 1.5 meters, so that the entire profile is located in the central area of ​​the image, and automatically set the camera parameters.

3. The method for rapid determination of black soil layer based on digital image processing according to claim 1 is characterized in that: In step S2, a white area with the highest brightness in the profile scale is selected and regarded as a whiteboard. The statistical average values ​​of the three channels R, G, and B in the area are considered equal, which is used as the basis for correction. According to the deviation between the RGB value of the pixel and the zero value corresponding to the whiteboard, the corresponding ratio is calculated and the perfect reflection method is used to perform color correction on the entire image. The detailed steps are as follows: S21, traverse each pixel point in the cross-sectional image, calculate the sum of the R+G+B pixels of each pixel point, and find the brightest point in the image and save it; S22, calculating the threshold T of the first 10% reference points according to the sum of the pixels; S23, traverse each pixel point in the cross-sectional image again, and calculate the cumulative sum and mean of the R, G, and B components of all points where R+G+B is greater than T; S24, calculating the gain coefficient of each channel of the image according to the value of the brightest point and the mean values ​​of R, G, and B; S25, processing each channel of each pixel of the image according to the gain coefficient, while ensuring that the quantized R, G, and B values ​​are within the range of [0,255].

4. The method for rapidly determining black soil layer based on digital image processing according to claim 1 is characterized in that: In step S3, the boundary of the black soil layer is determined according to the boundary and thickness of the soil genetic layer; in each soil genetic layer, a representative area is selected as the region of interest, and the color parameters of the region of interest are extracted as classification feature variables.

5. The method for rapid determination of black soil layer based on digital image processing according to claim 1 is characterized in that: In step S4, the black soil layer is identified and delineated for each profile, and the soil formation layer is divided into the black soil layer and the non-black soil layer according to the quantitative rules for determining the black soil layer for all profile image samples; The quantitative rules for determining the black soil layer are formulated as follows: Under moist soil conditions, chroma ≤3 and lightness ≤3; under dry conditions, lightness ≤5; Organic carbon content ≥12g / kg and ≤200g / kg.

6. The method for rapid determination of black soil layer based on digital image processing according to claim 1 is characterized in that: In step S5, the implementation steps of constructing the black soil layer determination model are as follows: S51, randomly divide the soil sample data of the "Is it a black soil layer" field into a training set and a validation set in a ratio of 7:3; S52, set the black soil layer to 1 and the non-black soil layer to 0 as the dependent variable; use the color parameter as the independent variable to build the RF machine learning classification model; S53, perform 50 independent iterations on the RF machine learning classification model, and output the model evaluation and prediction results respectively; after verification, select the model with the highest classification accuracy and save it as the black soil layer determination model.

7. The method for rapid determination of black soil layer based on digital image processing according to claim 6 is characterized in that: The color parameters include sRGB color space, sRGB color space inverse, sRGB color space logarithm, super red, sRGB color space band operation, Lab color model, Luv color model and CIEXYZ color space.

8. The method for rapid determination of black soil layer based on digital image processing according to claim 6 is characterized in that: In step S53, the detailed steps of selecting the model with the highest classification accuracy are as follows: S531, 50 independent iterations of the RF model; S532, verify and evaluate the classification accuracy of the RF model, select the RF model with the highest classification accuracy and save it; the classification accuracy uses the Kappa coefficient.

Citation Information

Patent Citations

  • Soil color mapping method based on measured data color cell division

    CN116468822A

  • Automatic soil picture classification management system

    CN117351291A

  • Method for identifying soil sequence structure and integrated device

    CN118052799A

  • Method and device for identifying thickness of thick black soil, medium and product

    CN118670277A

  • Method for determining property of rock by image processing

    JP2011154464A