Identification of Salt Applying Image Processing and Machine Learning Techniques
Identification of Salt Applying Image Processing and Machine Learning Techniques
Abstract— Salt is essential today due to its numerous applications Canny Edge Detection (CED) has been a widely used edge
in food, healthcare, and other industries. Several varieties of salt detection technique for obtaining object contour and gradient
are available on the market, and each has distinct physical information for many years. It is known for its low error rate,
features that are recognized based on its size, shape, color, and preservation of essential data, and minimal deviation from
texture. Despite these claims, a system that could distinguish salt original images [6]. CED is used for extracting features in an
is still non-existent. Furthermore, carrying out this study could image that consist of several phases for edge detection and
provide solution to the salt industry's need for more technology noise reduction. [7]. Studies have shown that CED is one of the
and innovation. In addition, using image processing and machine
promising algorithms used to extract features in an image.
learning techniques, this study created a system to identify five
distinct types of salt: Pink Himalayan, Black Himalayan, Black Researchers utilized canny edge detection to detect images of
Lava, Kosher, and Sea salts. The researchers utilized different fruits and several samples [8], [9].
image processing algorithms such as the K-means, CLAHE, Support vector machine (SVM) is a supervised machine
Grayscale, Gaussian Blur, Dilation, Morphology, and Erosion to learning technique that analyses categorical information by
enhance salt images. The Canny Edge Detection (CED) was employing several learning algorithms. [10]. Support Vector
utilized for feature extraction, while the SVM was used to identify Machine, together with image processing, is one of the training
five distinct kinds of salt. The system developed is implemented models utilized in most food grading and classification studies.
using a Raspberry Pi 4 microcontroller for hardware In existing research, the researchers used SVM for rice grading
development. The researchers also used a microscopic camera to
classification, in which the researchers obtained a high
capture salt samples. Overall, the researchers obtained an
accuracy of 96.218% while implementing the algorithm. accuracy rate for implementing the developed algorithm [11].
In an existing study, researchers conceptualized the same
Index Terms— Salt, Image Processing, Machine Learning,
training model for detecting raw meat, in which the researchers
Canny Edge Detection, Support Vector Machine, Raspberry Pi 4,
Microscopic Camera aimed to provide help to the food industry by implementing the
system they developed [12]. In addition, there is an existing
I. INTRODUCTION study wherein the researchers could classify fish by extracting
Nowadays, Artificial Intelligence (AI) has revolutionized the its features and performing model training using SVM and
food industry by enabling tasks like food quality evaluation, HOG features [13]. Another study implemented the concept of
control tools, classification, and prediction, emulating human image processing and machine learning with SVM, wherein
cognitive processes [1]. Machine vision and image processing researchers classified the ripeness of Cacao [14].
efficiently identify and classify agricultural goods like sugar, Artificial Intelligence has been used to recognize food and
rice, and coffee, providing fast, reliable, and non-destructive agricultural goods, but a salt-identifying system still needs to
assessments [2]. High accuracy rates in agricultural goods be developed. Furthermore, the salt industry faces challenges
recognition suggest the system's reliability for other goods, due to a need for more technology and innovation. This study
including salt, which can be identified and classified using high aims to introduce an innovation by creating a device that
magnification cameras, enhancing food processing and recognizes salts based on their physical attributes, using image
healthcare products. However, provided these statements, there processing and machine learning techniques. This study
still needs to be more studies about the identification of various produced data on morphological features and unknown
kinds of salt available in the market. Some prevailing studies parameters of salt.
implement different machine learning algorithms and image This study focused on identifying various kinds of salt
processing to recognize food and agricultural goods, including available in the market based on their physical characteristics,
sugar, coffee, and rice, in which they utilized SVM, ANN, particularly color, size, and shape. To accomplish this, the
KNN, Decision Tree Classifiers, Random Forest Classifiers, researchers used the following as part of their specific
Logistic Regression, and many more [3] – [5]. objectives: (1) To create hardware that will process the image
capture of various kinds of salt using Raspberry Pi. (2) To
II. METHODOLOGY
A. Conceptual Framework
Authorized licensed use limited to: REVA UNIVERSITY. Downloaded on June 19,2025 at 10:22:09 UTC from IEEE Xplore. Restrictions apply.
Figure 4 represents the image preprocessing procedure b.
Feature Extraction: Relevant information from the
implemented in this study. The first step is the conversion of sample is extracted, which reduces the amount of data.
RGB to K-means, which helps to group the data samples. The Recognition Phase:
next step is to convert the image to CLAHE, which is used for a. Pre-processing: Sample images undergo a series of
contrast enhancement of the image. The next phase is to convert image enhancement phases.
the image to grayscale, followed by Gaussian Blur, which helps b. Feature Extraction: Relevant information from the
to reduce noise in the image. Upon noise reduction, it will sample is extracted, which reduces the amount of data.
undergo dilation, enhancing the image's feature. Next, it will c. Matching: Evaluate feature vectors to different models
fall to morphology, which removes imperfections by to see the closest match. The feature vectors acquired
accounting the form and structure of the image. The last step is in the dataset are matched.
to apply erosion that will remove the pixel of the object's
boundaries, separating the overlapping objects and shrinking G. Experimental Setup
their boundaries.
E. Canny Edge Detection
Authorized licensed use limited to: REVA UNIVERSITY. Downloaded on June 19,2025 at 10:22:09 UTC from IEEE Xplore. Restrictions apply.
have the same color and size. Also, the researchers chose two Table I shows the morphological features of different salt
types of Himalayan salts to indicate that the system can classes, with Pink Himalayan having the highest equivalent
distinguish between their colors even though they are the same features and Kosher salt having the lowest equivalent
salt type. Also, the researchers included black lava salt to morphological features. The features extracted from the salt
compare it with another black salt. By adding the particular samples are the minor axis, major axis, area, and perimeter.
sample, the researchers are testing the ability of the system to These parameters were quantified to represent the difference of
distinguish between shades of color. salt samples based on their size and shape, described in the
pixels in an image. The difference in their values can be
observed since the samples tested have various sizes and forms,
which are also the physical attributes focused on in this study.
TABLE II
SAMPLE TESTING TABLE FOR THE ACTUAL AND PREDICTED OF
IDENTIFICATION OF SALT
Salt Image No. Actual Predicted
1 Pink Himalayan S. Pink Himalayan S.
2 Pink Himalayan S. Pink Himalayan S.
3 Pink Himalayan S. Pink Himalayan S.
4 Pink Himalayan S. Pink Himalayan S.
5 Pink Himalayan S. Pink Himalayan S.
6 Black Himalayan S. Black Himalayan S.
7 Black Himalayan S. Black Himalayan S.
8 Black Himalayan S. Black Himalayan S.
Fig. 8 Transformation of Data in Preprocessing 9 Black Himalayan S. Black Himalayan S.
Different image processing transformations are 10 Black Himalayan S. Black Himalayan S.
implemented upon capturing the salt sample. Figure 8 shows 11 Black Lava S. Black Lava S.
the transformation of data in the preprocessing part. This 12 Black Lava S. Black Lava S.
consists of ten (10) stages, which include conversion of RGB 13 Black Lava S. Black Lava S.
image to k-means, CLAHE, grayscale, gaussian blur, dilation, 14 Black Lava S. Black Lava S.
morphology, erosion, canny edge, and finally, the segmented 15 Black Lava S. Black Lava S.
output wherein the system extracted the boundaries of the 16 Kosher S. Kosher S.
object from the background [17]. The segmented output 17 Kosher S. Kosher S.
indicates the type of salt being detected by the system. In this 18 Kosher S. Kosher S.
case, the system recognized the sample to be a Black 19 Kosher S. Kosher S.
Himalayan salt. 20 Kosher S. Kosher S.
21 Sea S. Sea S.
III. RESULT AND DISCUSSION
22 Sea S. Sea S.
TABLE I 23 Sea S. Sea S.
MORPHOLOGICAL FEATURES OF SALT SAMPLES 24 Sea S. Sea S.
Salt Minor Major Area Perimeter 25 Sea S. Sea S.
Samples Axis Axis
Pink 153 to 149 to 27,118 662 to Table II illustrates the sample testing table for the
Himalayan 314 357 to 1,300 identification of salt. It consists of the number of salt images,
Salt 103,944 actual salt samples, and predicted results. Tabulating the test
Black 152 to 138 to 26,496 660 to results will help to demonstrate which salt sample is being
Himalayan 297 326 to 1,208 identified or misidentified.
Salt 91,104 TABLE III
Black 100 to 126 to 13,699 472 to
SUMMARY OF TEST RESULTS
Lava Salt 190 248 to 862
45,738 Salt Class Actual Predicted
Kosher 66 to 65 to 5,346 to 294 to Pink Himalayan S 20 17
Salt 131 107 12,322 448 Black Himalayan S. 20 19
Black Lava S. 20 19
Sea 158 to 153 to 27,540 666 to Kosher S. 20 20
Salt 235 265 to 968 Sea S. 20 16
58,240 Total 100 91
Authorized licensed use limited to: REVA UNIVERSITY. Downloaded on June 19,2025 at 10:22:09 UTC from IEEE Xplore. Restrictions apply.
Table III is the summary of test results conducted in this 2× ×
1− = (4)
study. The researchers tested a total of one hundred (100) +
samples from five (5) distinct types of salt samples. From the
TABLE IV
table, it can be observed that there are a total of ninety-one (91)
QUANTITATIVE STATISTICAL METRICS
correctly predicted samples.
Salt Class Accuracy Precision Recall F1-
TABLE III (%) (%) (%) Score
CONFUSION MATRIX (%)
Pink 95.79% 85% 94.44% 89.47%
Himalayan
Salt
Black 97.85% 95% 95% 95%
Himalayan
Salt
Black Lava 97.85% 95% 95% 95%
Salt
Table VII is the confusion matrix of the salt identification Total 96.22% 91% 91.33% 90.91%
system. On the left side is the actual result, whereas the upper
portion is the predicted result. The labels for each salt class are
also indicated in the confusion matrix, which is categorized into
five salt classes. The Pink Himalayan salt has a total of 20 tested Table IV illustrates the tabulated statistical metrics of the
samples, of which 17 are correctly identified, while three salt study. It consists of salt class and its accuracy, precision, recall,
samples were misidentified as Black Himalayan salt and Sea and f1-score. From the table, the total accuracy obtained is
salt. On the other hand, the Black Himalayan salt also has a total 96.22%. The precision, on the other hand, has a total of 91%.
of 20 tested samples, of which 19 are correctly identified, and The study also received a total of 91.33% recall. Lastly, the F1-
one is misidentified as Black Lava salt. Next, the Black Lava score obtained in this study is 90.91%. Overall, the results
salt also contains 20 tested samples, of which 19 are correctly obtained from this study is favorable.
identified, while 1 sample was misidentified as Kosher salt. For
the Kosher salt, there are 20 tested samples, of which the system IV. CONCLUSION AND RECOMMENDATION
correctly identifies all of them. Lastly, the Sea salt also has 20 The development of a system for the identification of salt
tested samples, of which 16 of them were correctly identified, using image processing and machine learning algorithms is
while the other samples were misidentified as Kosher salt and done by the researchers. The researchers were able to
Pink Himalayan salt. implement the system in Raspberry Pi. They utilized the Canny
Upon tabulating the confusion matrix, conditions such as Edge Detection for the extraction of features and the Support
True Positive (TP), False Positive (FP), True Negative (TN), Vector Machine for model training of different kinds of salt.
and False Negative (FN) are determined. Each condition The researchers of this study observed that some salt samples
corresponds to the variables produced in the confusion matrix. are hard to segment due to their small size. There were also
These conditions are utilized to determine the accuracy, expected misclassifications with the salt samples since two of
precision, recall and f1-score to better evaluate the performance them, sea salt and kosher, almost have the same color and size.
of the system. The following equations are utilized to compute The researchers validated the system using a confusion matrix,
the quantitative statistical metrics: in which they received a total accuracy of 96.22% for
implementing the algorithm.
+ For the recommendation, the researchers recommend using
= × 100 (1)
+ + + a wider lens camera to detect more salt samples. Additionally,
implementing a different approach for the image processing
= × 100 (2) could provide a better segmentation of the salt samples. Future
+ researchers may also consider using a different training model,
such as deep learning, for the data to produce a higher total
= × 100 (3) accuracy rate for salt identification.
+
Authorized licensed use limited to: REVA UNIVERSITY. Downloaded on June 19,2025 at 10:22:09 UTC from IEEE Xplore. Restrictions apply.
REFERENCES [15] M. V. Caya, D. Padilla, G. Ombay, and A. J. Hernandez, “Detection and
Counting of Red Blood Cells in Human Urine Using Canny Edge
[1] N. R. Mavani, J. M. Ali, S. Othman, M. A. Hussain, H. Hashim, and N. Detection and Circle Hough Transform Algorithms,” 2019 IEEE 11th
A. Rahman, “Application of Artificial Intelligence in Food Industry—a International Conference on Humanoid, Nanotechnology, Information
Guideline,” Food Engineering Reviews, vol. 14, no. 1, pp. 134–175, Technology, Communication and Control, Environment, and
Mar. 2022, doi: 10.1007/s12393-021-09290-z. Management (HNICEM), 2019, doi:
[2] M. E. Bahrami, M. Honarvar, and K. Ansari, “Feasibility of Using 10.1109/HNICEM48295.2019.9072708.
Digital Image Processing and Colorimetric Measurements to Estimate [16] C. Hortinela, J. Balbin, J. Fausto, P. D. Divina, and J. P. Felices,
the Physicochemical Properties of Raw Cane Sugars,” Sugar Tech, vol. “Identification of Abnormal Red Blood Cells and Diagnosing Specific
19, no. 3, pp. 305–316, Jun. 2017, doi: 10.1007/s12355-016-0467-5. Types of Anemia Using Image Processing and Support Vector
[3] C. Hortinela et al., “Classification of Cane Sugar Based on Physical Machine,” 2019 IEEE 11th International Conference on Humanoid,
Characteristics Using SVM,” 2019 IEEE 11th International Conference Nanotechnology, Information Technology, Communication and
on Humanoid, Nanotechnology, Information Technology, Control, Environment, and Management (HNICEM), 2019, doi:
Communication and Control, Environment, and Management 10.1109/HNICEM48295.2019.9072904.
(HNICEM)., 2019, doi: 10.1109/HNICEM48295.2019.9072699. [17] C. C. Hortinela et al., “Milled Rice Grain Grading using Raspberry Pi
[4] E. Arboleda, A. Fajardo, and R. Medina, “Classification of Coffee Bean with Image Processing and Support Vector Machines with Adaptive
Species Using Image Processing, Artificial Neural Network and K Boosting,” 2020 IEEE 12th International Conference on Humanoid,
Nearest Neighbors,” 2018 IEEE International Conference on Nanotechnology, Information Technology, Communication and
Semiconductor Electronics (ICSE2018): proceedings: 15-17 August Control, Environment, and Management, HNICEM 2020, Dec. 2020,
2018, Pullman Kuala Lumpur City Centre Hotel & Residence, Kuala doi: 10.1109/HNICEM51456.2020.9400102.
Lumpur, Malaysia, 2018, doi: 10.1109/ICIRD.2018.8376326.
[5] B. Arora, N. Bhagat, L. Saritha, and S. Arcot, “Rice Grain Classification
Using Image Processing Machine Learning Techniques,” Proceedings of
the 5th International Conference on Inventive Computation
Technologies, ICICT 2020, pp. 205–208, Feb. 2020, doi:
10.1109/ICICT48043.2020.9112418.
[6] M. K. M. Rabby, B. Chowdhury, and J. Kim, “A Modified Canny Edge
Detection Algorithm for Fruit Detection and Classification,” 2018 10th
International Conference on Electrical and Computer Engineering
(ICECE), 2018, doi: 10.1109/ICECE.2018.8636811.
[7] R. Anjum, R. R. Dipti, H. O. Rashid, and S. Ripon, “An Efficient Breast
Cancer Analysis Technique by Using a Combination of HOG and Canny
Edge Detection Techniques,” 2021 5th International Conference on
Trends in Electronics and Informatics (ICOEI), pp. 1290–1295, Jun.
2021, doi: 10.1109/ICOEI51242.2021.9453095.
[8] J. N. Uy and J. F. Villaverde, “A Durian Variety Identifier Using Canny
Edge and CNN,” 2021 7th International Conference on Control Science
and Systems Engineering, ICCSSE 2021, pp. 293–297, Jul. 2021, doi:
10.1109/ICCSSE52761.2021.9545195.
[9] C. Hortinela, J. Balbin, J. Fausto, and K. Viray, “Identification of
Crystals Present in a Urine Sediment based on Adaptive Boosting
Algorithm,” 2019 IEEE 11th International Conference on Humanoid,
Nanotechnology, Information Technology, Communication and
Control, Environment, and Management (HNICEM), 2019, doi:
10.1109/HNICEM48295.2019.9072865.
[10] A. Salman, A. Semwal, U. Bhatt, and V. M. Thakkar, “Leaf
classification and identification Using Canny Edge Detector and SVM
Classifier,” 2017 International Conference on Inventive Systems and
Control (ICISC), 2017, doi: 10.1109/ICISC.2017.8068597.
[11] K. M. A. Bejerano, C. C. Hortinela Iv, and J. J. R. Balbin, “Rice (Oryza
Sativa) Grading classification using Hybrid Model Deep Convolutional
Neural Networks - Support Vector Machine Classifier,” 4th IEEE
International Conference on Artificial Intelligence in Engineering and
Technology, IICAIET 2022, 2022, doi:
10.1109/IICAIET55139.2022.9936869.
[12] C. C. Hortinela, J. R. Balbin, J. C. Fausto, J. E. C. Espanillo, and J. K.
P. Padilla, “Detection of Staleness in Raw Chicken Meat Due to
Salmonella spp. And Escherichia Coli Bacteria Using Metal Oxide Gas
Sensor with Support Vector Machine,” 2020 IEEE 12th International
Conference on Humanoid, Nanotechnology, Information Technology,
Communication and Control, Environment, and Management, HNICEM
2020, Dec. 2020, doi: 10.1109/HNICEM51456.2020.9399997.
[13] M. R. Abalos and J. F. Villaverde, “Fresh Fish Classification Using
HOG Feature Extraction and SVM,” 2022 IEEE 14th International
Conference on Humanoid, Nanotechnology, Information Technology,
Communication and Control, Environment, and Management, HNICEM
2022, 2022, doi: 10.1109/HNICEM57413.2022.10109442.
[14] J. A. M. Galindo, J. E. C. Rosal, and J. F. Villaverde, “Ripeness
Classification of Cacao Using Cepstral-Based Statistical Features and
Support Vector Machine,” 4th IEEE International Conference on
Artificial Intelligence in Engineering and Technology, IICAIET 2022,
2022, doi: 10.1109/IICAIET55139.2022.9936807.
Authorized licensed use limited to: REVA UNIVERSITY. Downloaded on June 19,2025 at 10:22:09 UTC from IEEE Xplore. Restrictions apply.