Prediction of Soil pH using Smartphone based Digital Image Processing and Prediction Algorithm


Utpal Barman,Ridip Dev Choudhury,



Soil pH, K Mean,HSV,Linear Regression, KNN,ANN,


Soil pH is one of the major factors to be considered before doing any cultivation. Farmers always tested their soil pH either in soil pH laboratory, soil pH color chart or sometimes with the help of an expert. But these methods need time, labor and expertness. In this paper, a digital Smartphone image-based method is presented which predicts the soil pH in a simple and accurate way. Soil images are captured with the help of Redmi 3S prime Smartphone and store all the images as soil dataset. Soil images are processed through the different steps of digital image processing including soil image enhancement, soil image segmentation, and soil image feature extraction. During the feature extraction, Hue, Saturation and Value of the soil image are calculated and store Saturation and Hue plus Saturation as an index for the feature vector of the soil images. Prediction of soil pH is done with the help of Linear Regression, Artificial Neural Network, and KNN Regression. The coefficient of the linear regression is 0.859 for the Saturation feature of the soil image. Again, the coefficient of linear regression is 0.823 for Hue plus Saturation. The regression coefficient for ANN is 0.94064 with Levenberg-Marquardt algorithm and 0.92932 with Scaled Conjugate Gradient Backpropagation Algorithm. The regression coefficient of KNN is 0.89326 for K=5 with an RMSE value 0.1311. It is found that ANN always gives a better result as compare to another one.


I.Aziz, M.M, Ahmed, D.R., Abraham, B.F, 2016. “Determine the pH of Soil by using Neural Network Based on Soil’s Colour”. International Journal of Advanced Research in Computer science and Software Engineering, Vol.: 6, Issue: 11, pp: 51-54, 2018.

II.Abu, M.A., Nasir, E.M.M. and Bala, C.R, “Simulation of Soil PH Control system using Fuzzy Logic Method”,International Journal of Emerging Trends in Computer Image & Processing. Vol.: 3, Issue: 1,pp: 15-19, 2014.

III.Aditya, A., Chatterjee, N., Pradhan, C., “Computation and Storage of Possible Pouvoir Hydrogen Level of Soil using Digital Image processing”, International Conference on Communication and Signal Processing, India. pp: 205-209, 2017.

IV.Ayoubi, S., ShahriA, P., Karchegani, P.M., Sahrawat, K.L., “Application of Artificial Neural Network (ANN) to Predict Soil Organic Matter Using Remote Sensing Data in Two Ecosystems”. In: I. Atazadeh (Ed), Biomass and Remote Sensing Biomass. ISBN: 978-953-307. In Tech Publication. 2011.

V.Babu, C.S.M. and Pandian, M.A, “Determination of Chemical and Physical Characteristics of Soil using Digital Image processing”,International Journal of Emerging Technology in Computer Science & Electronics, Vol.: 20, Issue: 2,pp: 331-335, 2016.

VI.Barman, U., Choudhury, R., Talukdar, N., Deka, P., Kalita, I., & Rahman, N, “Prediction of soil pH using HSI colour image processing and regression over Guwahati, Assam”, India.Journal of Applied and Natural Science,Vo.: 10, Issue: 2,pp: 805-809,2018.

VII.Barman, U, Choudhury, R. D., Saud, A., Dey, S., Dey, B. K., Medhi, B.P., Barman, G.G., “Estimation of Chlorophyll Using Image Processing”, Int J Recent Sci Res, Vol.: 9, Issue: 3, pp: 24850-24853, 2018

VIII.Bodaghabadi, M.B., Martínez-Casasnovas, J.A., Salehi, M.H., Mohammadi, J., Borujeni, I.E., Toomanian, N., Gandomkar, A., “Digital Soil Mapping Using Artificial Neural Networks and Terrain-Related Attributes”, Pedosphere, Vol.: 25, Issue: 4, pp: 580-591, 2015.

IX.Dhanachandra, N., Manglem, k., Chanu y.J., “Image Segmentation Using K -means Clustering Algorithm and Subtractive Clustering Algorithm”,Procedia Computer Science. Vol.: 54, pp: 764-771, 2015.

X.Ebrahimi, M., Sinegani, A.K.S., Sarikhani, M.R.,Mohammadi, S.A., “Comparison of artificial neural network and multivariate regression models for prediction of Azotobacteria population in soil under different land uses”. Computers and Electronics in Agriculture.Vol.: 140, pp: 409-421, 2017.

XI.Gurubasava, Mahantesh S.D., “Analysis of Agricultural soil pH using Digital Image Processing” , International Journal of Research in Advent Technology, Vol.: 6, Issue: 8, pp: 1812-1816, 2018.


XIII.Kumar, V., Vimal, B., Kumar, R., Kumar, R., & Kumar, M, “Determination ofsoil pH by using digital image processing technique”.Journal of Applied and Natural Science, Vol.: 6, Issue: 1, pp: 14-18, 2014.

XIV.Matei, O., Rusu, T., Petrovan, A., Mihuţ G.,“A Data Mining System for Real Time Soil Moisture Prediction”, Procedia Engineering,Vol.: 181, pp: 837-844, 2017

XV.Mohan, R.R., Mridula S., Mohanan P., “Artificial Neural Network Model for Soil Moisture Estimation At Microwave Frequency”, Progress In Electromagnetics Research M, Vol.:43, pp: 175–181, 2015.

XVI.Pandey, A., Jha, S.K., Srivastava, J.K., Prasad R.,“Artificial neural network for the estimation of soil moisture and surface roughness”,Russ. Agricult. Sci. Vol.: 36, pp: 428-432, 2010.

XVII.Riccardi, M., Mele, G., Pulvento, C., lavini A., D‟AndriaS R.,Jacobsen E., “Non-destructive evaluation of chlorophyll content in quinoa and amaranth leaves by simple and multiple regression analysis of RGB image components”. Photosynth Res. Vol.: 120, pp: 263–72, 2014.

XVIII.Rigon, J.P.G., Capuani, S., Fernandes, D.M., Guimarães, T. M., 2016. “A novel method for the estimation of soybean chlorophyll content using asmartphone and image analysis”, Photosynthetica, Vol.:54, pp:559–566, 2016.

XIX.Ruiz, N. L., Curto, V.F., Erenas, M. M., Lopez, F. B., Diamond, D., Lopez, A. J. P, Valley, A.F.C., “Smartphone-Based Simultaneous pH and Nitrite Colorimetric Determination for Paper Microfluidic Devices”. Analytical Chemistry. Vol: 86, Issue: 19, pp:1-23, 2014.

XX.Sagar, S, Debjeet, B, Advait, L,Mishra, N., “Moisture And pH Detection Using Sensors And Automatic Irrigation System Using Raspberry Pi Based Image Processing”, International Journal of Engineering Technologies and Management Research, Vol.: 5, issue: 2, pp: 153-157, 2018.

XXI.Soil pH. Link:, U.C., Prapulla, Kumar. “Measurement of Soil PH Value Using HSV Color Space Value of Image”. International Journal of Innovative Research and Advanced Studies, Vol.: 3, Issue: 6, pp: 1-4, 2016.

XXIII.Taheri-Garavand, A., Meda, V., Naderloo, L., “Artificial neural Network−Genetic algorithm modeling for moisture content prediction of savory leaves drying process in different drying conditions”. Engineering in Agriculture, Environment and Food. Vol.: 11, Issue: 4, pp: 232-238.2018.

XXIV.Tenpe, A., Kaur,S., “Artificial neural network modeling for predicting compaction parameters based on index properties of soil”, Int J Sci Res (IJSR),Vol.: 4, issue: 7,pp: 1198–1202, 2015.

XXV.Utai, K., Nagle, M., Hämmerle, S., Spreer, W., Mahayothee, B., Müller, J., “Mass estimation of mango fruits (Mangifera indica L., cv. „Nam Dokmai‟) by linking image processing and artificial neural network”,Engineering in Agriculture, Environment and Food., Vol.: 12, Issue: 1, pp:103-110, 2019.

Utpal Barman, Ridip Dev Choudhury View Download