Spice Type Recognition Based on Shape and Color Features Using K-Nearest Neighbor and Fuzzy Methods

Authors

  • Sonia Syofyan Informatics, Science and Technology Faculty, Universitas Samudra, Langsa, Indonesia
  • Liza Fitria Informatics, Science and Technology Faculty, Universitas Samudra, Langsa, Indonesia
  • Munawir Informatics, Science and Technology Faculty, Universitas Samudra, Langsa, Indonesia

DOI:

https://doi.org/10.52436/1.jutif.2025.6.4.4456

Keywords:

Classification, Fuzzy, K-Nearest Neighbor (KNN), Spices

Abstract

Spices are natural ingredients that play an important role in everyday life, especially in traditional medicine. With a variety of shapes and colors, spices are often difficult to distinguish from one another. This research aims to classify spice types based on shape and color features using K-Nearest Neighbor (K-NN) and Fuzzy methods. This research will limit the recognition of spice types to 10 specific types of spices, namely ginger, turmeric, star anise, coriander, pepper, nutmeg, galangal, cinnamon, cloves, and candlenut. Spice type recognition will be done based on shape, color and texture features extracted using 300 training data images. The application of the K-NN method and Fuzzy logic allows flexible processing of color features (HSV). Fuzzy logic classifies spice color characteristics by generating a color score (color_score), which is then used to better interpret and distinguish spice colors for the classification process between test data and training data by the K-NN method. The test results show that from a total of 100 test data, the system successfully classifies spices with an accuracy rate of 77%.

Downloads

Download data is not yet available.

References

Mohammad Fathi Royyani, Asep Hidayat, Oscar Efendy, Wardah, and Ida Farida Hasanah, Rempah Perjalanan Penyintas Peradaban. 2023. doi: 10.55981/brin.700.

R. Koen Asharo, “Pengolahan Hasil Budidaya Tanaman Rimpang dengan Teknik Vertikultur demi Mendukung Ekonomi Kreatif Masyarakat Rawamangun Jakarta Timur,” Sarwahita, vol. 19, no. 01, pp. 133–146, 2022, doi: 10.21009/sarwahita.191.12.

A. Arifin, J. Hendyli, and D. E. Herwindiati, “Klasifikasi Tanaman Obat Herbal Menggunakan Metode Support Vector Machine,” Comput. J. Comput. Sci. Inf. Syst., vol. 5, no. 1, p. 25, 2021, doi: 10.24912/computatio.v1i1.12811.

Y. Yuhandri, A. Ramadhanu, and H. Syahputra, “Pengenalan Teknologi Pengolahan Citra Digital (Digital Image Processing) Untuk Santri Di Rahmatan Lil’Alamin International Islamic Boarding School,” Community Dev. J. J. Pengabdi. Masy., vol. 3, no. 2, pp. 1239–1244, 2022, doi: 10.31004/cdj.v3i2.5868.

D. T. Worung, S. R. U. A. Sompie, and A. Jacobus, “Implementasi K-Means dan K-NN pada Pengklasifikasian Citra Bunga,” J. Tek. Inform., vol. 15, no. 3, pp. 217–222, 2020, [Online]. Available: https://ejournal.unsrat.ac.id/v3/index.php/informatika/article/view/31965%0Ahttps://doi.org/10.35793/jti.15.3.2020.31965

N. Puspitasari, A. Septiarini, and A. R. Aliudin, “Metode K-Nearest Neighbor Dan Fitur Warna Untuk Klasifikasi Daun Sirih Berdasarkan Citra Digital,” PROSISKO J. Pengemb. Ris. dan Obs. Sist. Komput., vol. 10, no. 2, pp. 165–172, 2023, doi: 10.30656/prosisko.v10i2.6924.

R. Wongkhuenkaew, S. Auephanwiriyakul, N. Theera-Umpon, K. Teeyapan, and U. Yeesarapat, “Fuzzy K-Nearest Neighbor Based Dental Fluorosis Classification Using Multi-Prototype Unsupervised Possibilistic Fuzzy Clustering via Cuckoo Search Algorithm,” Int. J. Environ. Res. Public Health, vol. 20, no. 4, pp. 1–18, 2023, doi: 10.3390/ijerph20043394.

D. I. Muhammad, E. Ermatita, and N. Falih, “Penggunaan K-Nearest Neighbor (KNN) untuk Mengklasifikasi Citra Belimbing Berdasarkan Fitur Warna,” Inform. J. Ilmu Komput., vol. 17, no. 1, p. 9, 2021, doi: 10.52958/iftk.v17i1.2132.

D. Wandi, F. Fauziah, and N. Hayati, “Deteksi Kelayuan Pada Bunga Mawar dengan Metode Transformasi Ruang Warna Hue Saturation Intensity (HSI) dan Hue Saturation Value (HSV),” J. Media Inform. Budidarma, vol. 5, no. 1, p. 308, 2021, doi: 10.30865/mib.v5i1.2562.

S. Y. Riska and L. Farokhah, “Klasifikasi Bumbu Dapur Indonesia Menggunakan Metode K-Nearest Neighbors (K-NN),” Smatika J., vol. 11, no. 01, pp. 37–42, 2021, doi: 10.32664/smatika.v11i01.568.

Z. Fan, J. K. Xie, Z. Y. Wang, P. C. Liu, S. J. Qu, and L. Huo, “Image Classification Method Based on Improved KNN Algorithm,” J. Phys. Conf. Ser., vol. 1930, no. 1, 2021, doi: 10.1088/1742-6596/1930/1/012009.

R. S. A. Daulay, “Analisis Kritis dan Pengembangan Algoritma K-Nearest Neighbor (KNN): Sebuah Tinjauan Literatur,” J. Pendidik. Sains dan Komput., vol. 4, no. 02, pp. 131–141, 2024, doi: 10.47709/jpsk.v4i02.5055.

A. Ananda, E. Sulistianingsih, and Yundari, “Metode Ensemble K-Nearest Neighbor Untuk Peningkatan Akurasi Prediksi Indeks Harga Saham Gabungan Di Indonesia,” Bul. Ilm. Math. Stat. dan Ter., vol. 13, no. 3, pp. 339–348, 2024.

A. R. L. M. Yanita Selly Meristika, “Perbandingan K-Nearest Neighbor dan Fuzzy K-Nearest Neighbor pada DiagnosisPenyakit Diabetes Melitus.” 2021. [Online]. Available: https://repository.ub.ac.id/id/eprint/145669/8/Jurnal.pdf

U. Athiyah, A. P. Handayani, M. Y. Aldean, and N. P. Putra, “Sistem Inferensi Fuzzy : Pengertian, Penerapan, dan Manfaatnya,” vol. 1, no. 2, pp. 73–76, 2021.

J. Jumadi, Y. Yupianti, and D. Sartika, “Pengolahan Citra Digital Untuk Identifikasi Objek Menggunakan Metode Hierarchical Agglomerative Clustering,” JST (Jurnal Sains dan Teknol., vol. 10, no. 2, pp. 148–156, 2021, doi: 10.23887/jstundiksha.v10i2.33636.

D. Apriyanti and A. B. Suwardi, “Inventarisasi Jenis Tanaman Rempah Dan Pemanfaatannya Di Dusun Air Terjun Desa Paya Tampah, Aceh Tamiang,” Biosel Biol. Sci. Educ., vol. 13, no. 1, pp. 57–65, 2024, doi: 10.33477/bs.v13i1.7060.

M. Oni, B. Kanata, and D. Ratnasari, “MENENTUKAN LUAS OBJEK CITRA DENGAN TEKNIK SEGMENTASI BERDASARKAN WARNA PADA RUANG WARNA HSV Determining the Image Object Area Using Color-Based Segmentation Technique in HSV Color Space,” vol. 8, no. 2, pp. 137–146, 2021.

D. H. Naufal and R. Rahmadewi, “Pengelolaan Citra Digital ( Perbandingan Studi Kasus Antara Klasifikasi Warna Menggunakan Pengolahan Model Warna HSV Dan Penerapan Metode Konvolusi Dalam Pengolahan Citra Digital ),” J. Ilm. Wahana Pendidik., vol. 10, no. 20, pp. 168–177, 2024, [Online]. Available: https://doi.org/10.5281/zenodo.14272836

G. A. Trianto, F. J. Sinaga, M. F. Marzuki, and Q. Al Qorni, “Operasi Opening dan Closing pada Pengolahan Citra Digital Menggunakan Matlab,” Mdp Student Conf., pp. 104–110, 2022.

M. Tri Wahyudi and S. Lestari, “Analisis Kematangan Buah Pisang dengan Metode Gray Level Co-Occurence Matrix (GLCM) Banana Fruit Ripeness Analysis Using the Gray Level Co-Occurrence Matrix (GLCM) Method,” Multi Prox. J. Stat. Univ. Jambi, vol. 1, no. 2, pp. 93–102, 2022, [Online]. Available: https://online-journal.unja.ac.id/multiproximityhttps://doi.org/10.22437/multiproximity.v1i2.18630

M. Iqbal Mubarok, P. Purwantoro, and C. Carudin, “Penerapan Algoritma K-Nearest Neighbor (Knn) Dalam Klasifikasi Penilaian Jawaban Ujisan Esai,” JATI (Jurnal Mhs. Tek. Inform., vol. 7, no. 5, pp. 3446–3452, 2024, doi: 10.36040/jati.v7i5.7676.

Yudha Febrian, R. A. Yahya, M. I. Dzaluli, and M. E. Ardy Seto Priambodo, ST., “Implementasi Fuzzy Logic dengan sistem Visual Camera pada Robot Jetbot sebagai Line Follower,” Electr. J. Rekayasa dan Teknol. Elektro, vol. 17, no. 3, pp. 287–291, 2023, doi: 10.23960/elc.v17n3.2491.

R. Nurhidayat and K. E. Dewi, “Penerapan Algoritma K-Nearest Neighbor Dan Fitur Ekstraksi N-Gram Dalam Analisis Sentimen Berbasis Aspek,” Komputa J. Ilm. Komput. dan Inform., vol. 12, no. 1, pp. 91–100, 2023, doi: 10.34010/komputa.v12i1.9458.

F. Istighfarizky, N. A. Sanjaya, and M. Widiartha, “Klasifikasi Jurnal menggunakan Metode KNN dengan Mengimplementasikan Perbandingan Seleksi Fitur,” no. July, 2022, doi: 10.24843/JLK.2022.v11.i01.p18.

Additional Files

Published

2025-08-19

How to Cite

[1]
S. . Syofyan, L. . Fitria, and M. Munawir, “Spice Type Recognition Based on Shape and Color Features Using K-Nearest Neighbor and Fuzzy Methods”, J. Tek. Inform. (JUTIF), vol. 6, no. 4, pp. 2297–2316, Aug. 2025.