Smartphone-Based Digital Image Analysis for Qualitative Classification of Food Dyes Using Machine Learning: Effects of Color Space and Lighting Conditions - Yozef Tjandra; Giovania Halim; Jansen Briano; Martin Tjahjono (Program Studi Pendidikan Kimia FKIP Universitas Sebelas Maret, 2025)
Smartphone-based digital image analysis (DIA) has emerged as an affordable and accessible method for chemical analysis, particularly in colorimetry. While most existing studies have focused on quantitative applications, this study explores a machine learning–assisted DIA approach for the qualitative classification of synthetic food dyes. Digital images of nine food dyes solutions (Carmoisine, Sunset Yellow, Allura Red, Ponceau 4R, Tartrazine, Fast Green FCF, Brilliant Blue FCF, Quinoline Yellow WS, and Indigo Carmine), were captured under both controlled (closed) and open lighting conditions using a smartphone camera. The images were subsequently processed to extract color values in different color spaces, namely RGB, normalized RGB (rgb), HSL, and CIELAB. These values served as input features for a k-nearest neighbors (KNN) classifier trained to identify the dye present in each solution. The KNN model performed well on model solutions, with at least 86% accuracy across all color spaces and lighting conditions. To assess practical applicability, the classifier was also tested on seven commercial food and health products. The results show that HSL color space yielded the highest classification accuracy in the commercial sample testing, across both lighting setups, with the open condition consistently producing better performance. These findings demonstrate the potential use of smartphone-based DIA combined with machine learning for low-cost, portable, and reliable solutions for qualitative colorimetric analysis.