SciELO - Scientific Electronic Library Online

vol.20 issue12Irrigation and organic fertilization on the production of essential oil and flavonoid in chamomileTillage systems and cover crops on soil physical properties after soybean cultivation author indexsubject indexarticles search
Home Pagealphabetic serial listing  

Services on Demand




Related links


Revista Brasileira de Engenharia Agrícola e Ambiental

Print version ISSN 1415-4366On-line version ISSN 1807-1929

Rev. bras. eng. agríc. ambient. vol.20 no.12 Campina Grande Dec. 2016 


Use of digital images to estimate soil moisture

Uso de imagens digitais para estimar a umidade do solo

João F. C. dos Santos1 

Heider R. F. Silva2 

Francisco A. C. Pinto3 

Igor R. de Assis4 

1Universidade Federal de Viçosa/Centro de Ciências Agrárias/Departamento de Engenharia Florestal. Viçosa, MG. E-mail: (Corresponding author)

2Universidade Federal de Viçosa/Centro de Ciências Agrárias/Departamento de Fitotecnia. Viçosa, MG. E-mail:

3Universidade Federal de Viçosa/Centro de Ciências Agrárias/Departamento de Engenharia Agrícola e Ambiental. Viçosa, MG. E-mail:

4Universidade Federal de Viçosa/Centro de Ciências Agrárias/Departamento de Solos. Viçosa, MG. E-mail:


The objective of this study was to analyze the relation between the moisture and the spectral response of the soil to generate prediction models. Samples with different moisture contents were prepared and photographed. The photographs were taken under homogeneous light condition and with previous correction for the white balance of the digital photograph camera. The images were processed for extraction of the median values in the Red, Green and Blue bands of the RGB color space; Hue, Saturation and Value of the HSV color space; and values of the digital numbers of a panchromatic image obtained from the RGB bands. The moisture of the samples was determined with the thermogravimetric method. Regression models were evaluated for each image type: RGB, HSV and panchromatic. It was observed the darkening of the soil with the increase of moisture. For each type of soil, a model with best fit was observed and to use these models for prediction purposes, it is necessary to choose the model with best fit in advance, according to the soil characteristics. Soil moisture estimation as a function of its spectral response by digital image processing proves promising.

Key words: soil color; image processing; RGB; HSV


Objetivou-se, neste trabalho, analisar a relação entre a umidade e a resposta espectral do solo para gerar modelos de predição. Amostras com diferentes umidades foram preparadas e fotografadas. As fotografias foram tomadas em condição de luz homogênea e com correção prévia do balanço de brancos na câmera fotográfica digital. As imagens foram processadas para extração dos valores medianos nas bandas Vermelho, Verde e Azul do espaço de cores RGB; Matiz, Saturação e Valor do espaço de cores HSV; e valores dos números digitais de uma imagem pancromática obtida das bandas RGB. A umidade das amostras foi determinada com o método termogravimétrico. Modelos de regressão foram avaliados para cada tipo de imagem: RGB, HSV e pancromática. Observou-se o escurecimento do solo com aumento da umidade. Para cada tipo de solo houve um modelo com melhor ajuste. Para que modelos de predição possam ser utilizados é necessário escolher previamente o melhor modelo em função das características do solo. A estimativa da umidade do solo em função de sua resposta espectral por meio do processamento de imagens digitais mostra-se promissora.

Palavras-chave: cor do solo; processamento de imagens; RGB; HSV


Soil moisture is the measurement of the amount of water in liquid or gaseous state, present in the soil porous space at a given time. This characteristic is related to important hydrological processes such as infiltration rate, surface runoff and evapotranspiration (Su et al., 2014). In the agricultural field, this parameter directly influences the yield of a crop (Kaleita et al., 2005). Still in times of water rationing, the adequate irrigation management depends on the good knowledge about soil moisture (Hanson et al., 2000).

Dobriyal et al. (2012) present various approaches to determine soil moisture. For local scales, the thermogravimetric method is the most used procedure; this methodology, although precise and safe, is little practical, because it requires the collection of a large number of samples and a long drying time to achieve the results.

Moisture is also a factor that influences the spectral response of the soil (Dalmolin et al., 2005). For different water contents, the electromagnetic energy reflected by the soil surface is viewed as different tones of a color space. Thus, models for moisture prediction based on the spectral response of the soil can be obtained, for example, through spectrophotometry and orbital remote sensing (Kaleita et al., 2005; Ben-Dor et al., 2009; Bertoldi et al., 2014) or by the use of images from portable digital cameras (Kuchenbuch & Ingram, 2002; Persson, 2005a; Zhu et al., 2010; 2011; Cumbrera et al., 2012). This latter approach can generate instantaneous results and use devices that are generally easy to purchase, such as common digital cameras.

This study aimed to determine equations to estimate soil moisture using variables of color spaces obtained from images of a portable digital camera.

Material and Methods

Six soils available in the database of the Federal University of Viçosa (UFV) were used in this study. Their physical characteristics, textural class, contents of organic matter and color, according to the visual interpretation of the Munsell chart, are presented in Table 1.

Table 1 Physical characteristics, organic matter content and color of the samples of the soils 

Portions of soil were sieved (2 mm mesh) to remove gravel and roots, and dried in an oven (65 ºC) until reaching constant weight. Then, samples were prepared with gradual addition of distilled water (approximately 5%) varying from the constant weight (dry soil) until a value close to saturation. Three samples were prepared for each soil moisture. All samples were photographed, weighed and then dried in an oven at 105-110 °C for 24 h for the determination of gravimetric moisture (U(%)). U (%) was determined according to the methodology of EMBRAPA (2011) using Eq. 1.


U (%) - gravimetric moisture, %;

Wd - weight of dry sample, g:

Ww - weight of wet sample, g; and,

Wc - weight of the container used, g.

Attention was paid to homogenizing the portion of soil with the distilled water, i.e., guaranteeing that the entire soil sample had the same moisture content. When necessary, a crucible with a mortar was used to break up the aggregates. The surfaces of the samples were leveled to minimize the effects of shading by microrelief or by the edge of the container.

The images were captured with a NIKON Coolpix L810 digital photographic camera with lens of 4-104 mm. In order not to have pixels with saturated values (digital numeric value of 255) in the soil portion of the captured image, pre-tests were conducted with different adjustments of diaphragm opening, exposure time and ISO (International Standards Organization) sensitivity of the camera. Under the conditions the images were captured for this experiment, the following camera parameters were defined in these pre-tests: diaphragm opening equal to f/3.1; exposure time of 1/30s and ISO sensitivity of 200. The camera was positioned on the nadir at approximately 23 cm from the surface of the samples. The geometric resolution of 1600 x 1200 pixels was used.

In order to achieve the local control of the illumination, it was necessary to correct the white balance of the digital camera. The white balance refers to the adjustments performed by the photographer (manual mode) or by the photographic camera (automatic mode) to obtain images with colors close to those the objects have under specific illumination. The adequate white balance helps to avoid distortions in the colors and, in order to apply it correctly, one must consider the color of the light source.

In this experiment, the white balance was adjusted using the pre-setting option available in the camera. A grey chart was used as the base for the correction of the illumination. The illumination of the laboratory was performed with fluorescent lamps. The grey chart was also useful to evaluate the illumination homogeneity, since, when the illumination is homogeneous, all pixels of a photograph of the chart have the same value.

The image processing steps were performed in the software Matlab (version 6.5 R13). After photographing the soil samples, the central region of the images was cropped. This action was necessary to disregard the white background and the region influenced by the edges of the containers with the samples. Therefore, a central square area of approximately 150 x 150 pixels was used, according to the recommendation of Persson (2005a).

The values of each one of the bands of the RGB color space were extracted for the calculation of the median. The use of the median is suggested by Persson (2005a) as a way to overcome the deviations caused by the shading of the microrelief formed on the surfaces of the soil samples. The images were converted from RGB to the HSV color space to obtain the median values of hue, saturation and value, and also converted to panchromatic images, obtaining the median value of the digital number.

In the HSV space, the colors are represented by the parameters: hue (tones), saturation (purity) and value (brightness), all varying between zero and one. The transformation from RGB to HSV followed the procedures presented by Hanbury (2002).

The DN values of the monochromatic images were obtained by Eq. 2, assuming the values of conversion of the National Television System Committee (NTSC), according to Solomon & Breckon (2013).

The quality of the models was evaluated using validation samples, which were processed in a similar way as those used in the construction of the models. The estimates obtained with the models were confronted with the reference values (obtained by the thermogravimetric method) for the calculation of the root mean squared error (RMSE).

Results and Discussion

In order to test the calibration of the white balance, the white side of the grey chart was previously photographed. The RGB values of this photograph showed digital numbers (DNs) between 248 and 255, which indicated an efficient correction and homogeneity of illumination.

There was negative correlation between the values of the red, green, blue bands and soil moisture (Table 2), indicating that the soils became darker always when soil moisture increased. As a general spectral characteristic, the soils reflected more the red wavelengths, followed by green and blue (Figure 1). For this same reason, Kuchenbuch & Ingram (2002) used only red band values to predict soil moisture in an experiment with maize growth in transparent pots.

Table 2 Correlations between color parameters and soil moisture 

R - Red; G - Green; B - Blue; H - Hue; S - Saturation; V - Value; DN - Digital number of the panchromatic image

Figure 1 Variation in the digital numbers (DN) of the red, green and blue bands of the RGB color space as a function of the moisture content (U(%)): soil 1 (A), soil 2 (B), soil 3 (C), soil 4 (D), soil 5 (E), soil 6 (F) 

The darkening of the soil can be explained, in optical terms, by the variation in the refraction index of the dry soil and wet soil. When water is added, the contrast between soil particles and the surrounding medium decreases, because the refraction index on the water/particle interface is lower than the refraction index in these areas in dry soils (Twomey et al., 1986).

In the HSV color space, the response to moisture variation was different for each soil. Therefore, there is no response pattern of the soils in this color space to the variation of moisture. The behavior of soils 1 and 6 was different from that of the others. While the values of Hue and Value decreased, the Saturation increased (Figure 2) and, therefore, it showed positive correlation with soil moisture (Table 2). Saturation is the measurement of color purity; hence, the higher the value, the purer and less grey the image. The soils 1 and 6 have similar proportions of silt, sand and clay, besides a similar color (Table 1). The soil with highest organic matter content (Soil 2) showed the lowest variation in the HSV parameters. For all soils, the parameter Value decreased on average by 0.2 units between the dry samples and the saturated samples.

Figure 2 Variation in the digital numbers (DN) of the Hue, Saturation and Value bands of the HSV color space as a function of the moisture content (U(%)): soil 1 (A), soil 2 (B), soil 3 (C), soil 4 (D), soil 5 (E), soil 6 (F) 

For the panchromatic image, the correlations varied from-0.64 (soil 3) to -0.92 (soils 1 and 6, respectively). It is possible to note that the variation in DNs due to the increase in soil moisture differs between the types of soils (Figure 3). These differences are attributed to characteristics such as texture, mineralogical composition and organic matter content, because these variables influence soil reflectance (Dalmolin et al., 2005). Zhu et al. (2010), for example, studied soils with similar mineralogy and organic matter contents, varying only the texture. These authors concluded that there is a negative exponential variation between the water content and the DNs of a panchromatic image and that the roughness of the samples, influenced by the texture, significantly interferes with the spectral response of this image.

Figure 3 Behavior of the digital number (DN) of the panchromatic image as a function of the variation in gravimetric moisture content (U(%)): soil 1 (A), soil 2 (B), soil 3 (C), soil 4 (D), soil 5 (E), soil 6 (F) 

Soil 2 differs from the others regarding the increased content of organic matter (Table 1). Despite its higher content, this soil has a reddish color (5 YR 4/4 dry and 5 YR 3/3 wet). This soil possibly contains high content of hematite, a mineral that tends to mask the effects of organic matter on soil color (Resende, 1976). Due to its high opacity, hematites tend to stabilize the reflectance of the soils even with variation of moisture (Stoner et al., 1991).

At moisture values close to the saturation of the samples, i.e., when the entire porous space was filled by water, the DNs tended to increase. This behavior can be explained by the formation of a layer of water on the surface of the samples, which increases the reflectance. A similar behavior was observed by Kuchenbuch & Ingram (2002), Persson (2005a) and Zhu et al. (2011). In practical terms, it is possible to conclude that the relationship between the spectral response and soil moisture is well explained by the images of common digital cameras for moisture values below saturation.

In order to reduce the effect of the reflection by the layer of water, the interval of moisture values used for the analyses varied among the studied soils (Figures 1, 2 and 3). Since sand particles are larger than clay particles, the capacity of water adsorption in sandy soils (smaller specific surface) is lower in comparison to clayey soils and, therefore, they saturate with a smaller amount of water. Hence, sandier soils showed lower range of evaluation compared with more clayey soils. The specific surface also explains why the color of sandy soils is more easily altered by the presence of organic matter.

The highest deviations in relation to the mean in the values of the parameters (RGB, HSV and panchromatic image) were observed in the samples totally dried or close to saturation. In these two ranges, it was difficult to level the surface of the samples.

Linear models with 1, 2 and 3 independent variables were tested for each color space (RGB and HSV). A linear model using only the DNs of the panchromatic image was also evaluated. In the comparison between models, the RMSE value was evaluated. The addition of a third factor did not improve much the fit and, therefore, these models were not selected.

The equations with the best fits are presented in Table 3. Among the tested models, the variables Saturation (S) and Value (V) of the HSV color space stood out for the soils 1, 3 and 5. Thus, the model proposed by Persson (2005a) represents a good form to estimate the moisture of these soils. A satisfactory fit was obtained with the use of this model, although it was inferior to those found by this author. Since the red band has higher DNs and according to the relationships of conversion from RGB to HSV (Hanbury, 2002), the parameter Value, for all soils, was obtained by making R/255. Hence, the correlation of the red band (Table 2) was incorporated into this model. Additionally, this model has the contribution of the Saturation band, which varied as a function of soil characteristics (Figure 2).

Table 3 Equations to estimate soil moisture (Y) as a function of color variables through digital images and the respective determination coefficients (R2

R - Red; G - Green; B - Blue; H - Hue; S - Saturation; V - Value; DN - Digital number of the panchromatic image; RMSE - Root mean squared error

For the soils 2 and 6, the best model was the one in which only the parameter Value was used as independent variable. In these cases, the same results are found when using only the Red band, as proposed by Kuchenbuch & Ingram (2002). The DNs of the panchromatic image were also useful to determine the moisture of soil 6. For soil 4, a model that considers the Blue and Green bands of the RGB color space demonstrated superior performance; however, in this case, there was also significance when the S and V bands were considered as independent variables.

The results demonstrate that, in order to estimate the moisture of soils analyzed as a function of the variation in the spectral response, the characteristics of the soil must be previously analyzed so that the most satisfactory model is selected. There is still the need for complementary studies with different soil classes to understand the relationship between soil moisture and the spectral response of the soil.

Moisture determination through digital images is a nondestructive method that must be improved for the in loco determination without the need for collecting samples. One disadvantage of the method is that it determines only the moisture on the surface of the samples.

The present study shows that it is possible to estimate soil moisture based on the spectral response of samples, provided that some precautions are taken, such as the correction of illumination and white balance. It should be pointed out that the electromagnetic energy reflected by the soil surface is a property of the sensor of the camera and, therefore, without the proper corrections, the results will vary from camera to camera (Persson, 2005b).

In future studies, evaluations should be performed using reflectance values, photographic cameras with bands on the infrared spectrum and hyperspectral cameras.


  1. Images from common digital cameras, with adequate processing, can be used to estimate moisture of different soil classes.

  2. For each type of soil, different linear models must be tested, with bands of the color spaces RGB, HSV and digital numbers of a panchromatic image as independent variables, in order to find the most adequate.

  3. The methodology of the present study allowed an efficient correction of the white balance of the digital camera, a fundamental step for the standardization of the photographs.


The authors would like to thank the following Brazilian Governamental Funding Agencies: The Coordination for the Improvement of Higher Education Personnel (CAPES) and The National Council for Scientific and Tecnological Development (CNPq).

Literature Cited

Ben-Dor, E.; Chabrillat, S.; Demattê, J. A. M.; Taylor, G. R.; Hill, J.; Whiting, M. L.; Sommer, S. Using imaging spectroscopy to study soil properties. Remote Sensing of Environment, v.113, p. S38-S55, 2009. ]

Bertoldi, G.; Della Chiesa, S.; Notarnicola, C.; Pasolli, L.; Niedrist, G.; Tappeiner, U. Estimation of soil moisture patterns in mountain grasslands by means of SAR RADARSAT2 images and hydrological modeling. Journal of Hydrology, v.516, p.245-257, 2014. ]

Cumbrera, R.; Tarquis, A. M.; Gascó, G.; Millán, H. Fractal scaling of apparent soil moisture estimated from vertical planes of Vertisol pit images. Journal of Hydrology, v.452, p.205-212, 2012. ]

Dalmolin, R. S. D.; Gonçalves, C. N.; Klamt, E.; Dick, D. P. Relação entre os constituintes do solo e seu comportamento espectral. Ciência Rural, v.35, p.481-489, 2005. ]

Dobriyal, P.; Qureshi, A.; Badola, R.; Hussain, S. A. A review of the methods available for estimating soil moisture and its implications for water resource management. Journal of Hydrology, v.458, p.110-117, 2012. ]

EMBRAPA - Empresa Brasileira de Pesquisa Agropecuária. Manual de métodos de análises de solo. Rio de Janeiro: EMBRAPA, 2011. 230p. [ Links ]

Hanbury, A. The taming of the hue, saturation and brightness colour space. In: Of Computer, 7, 2002; Bad Aussee. Proceedings... Vienna: Vienna University of Technology, 2002. p.234-243. [ Links ]

Hanson, B.; Orloff, S.; Peters, D. Monitoring soil moisture helps refine irrigation management. California Agriculture, v.54, p.38-42, 2000. ]

Kaleita, A. L.; Tian, L. F.; Hirschi, M. C. Relationship between soil moisture content and soil surface reflectance. Transactions of the ASAE, v.48, p.1979-1986, 2005. ]

Kuchenbuch, R. O.; Ingram. K. T. Image analysis for non destructive and non invasive quantification of root growth and soil water content in rhizotrons. Journal of Plant Nutrition and Soil Science, v.165, p.573-581, 2002.;2-WLinks ]

Persson, M. Accurate dye tracer concentration estimations using image analysis. Soil Science Society of America Journal, v.69, p.967-975, 2005a. ]

Persson, M. Estimating surface soil moisture from soil color using image analysis. Vadose Zone Journal, v.4, p.1119-1122, 2005b. ]

Resende, M. Mineralogy, chemistry, morphology and geomorphology of some soils of the Central Plateau of Brazil. West Lafayette: Purdue University, 1976. 327p. Tese Doutorado [ Links ]

Solomon, C.; Breckon, T. Fundamentos do processamento de imagens digitais: Uma abordagem prática com exemplos em Matlab. 1.ed. Rio de Janeiro: LTC, 2013. 289p. [ Links ]

Stoner, E.; Derksen, I.; Macedo, J. Discriminação espectral de Latossolos do Planalto Central brasileiro. Pesquisa Agropecuária Brasileira, v.26, p.1599-1606, 1991. [ Links ]

Su, S. L.; Singh, D. N.; Baghin, I. M. S. A critical review of soil moisture measurement. Measurement, v.54, p.92-105, 2014. ]

Twomey, S. A.; Bohren, C. F.; Mergenthaler, J. L. Reflectance and albedo differences between wet and dry surfaces. Applied Optics, v.25, p.431-437, 1986. ]

Zhu, Y.; Wang, Y.; Shao, M. Using soil surface gray level to determine surface soil water content. Science China Earth Sciences, v.53, p.1527-1532, 2010. ]

Zhu, Y.; Wang, Y.; Shao, M.; Horton, R. Estimating soil water content from surface digital image gray level measurements under visible spectrum. Canadian Journal of Soil Science, v.91, p.69-76, 2011. ]

Received: January 17, 2016; Accepted: October 03, 2016 (Corresponding author)

Creative Commons License This is an Open Access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.