Real-Time Object Color Detection Using the HSV Method in Python - Farhan, Muhammad; Syahada Mawarda Hutagalung, Syahada Mawarda Hutagalung; Muhammad Alfariz Rasyid, Muhammad Alfariz Rasyid; Dafa Ikhwanu Shafa, Dafa Ikhwanu Shafa; Supiyandi, Supiyandi (Raskha Media Group, 2025)
This study discusses real-time object color detection using the HSV (Hue, Saturation, Value) method in the Python programming language. A common problem in RGB-based color recognition is its high sensitivity to changes in light intensity, resulting in unstable detection results. Therefore, the HSV color space is used, which better aligns with human perception of color and is able to separate color (hue) information from lighting (value). By utilizing the HSV color space, the system can distinguish colors based on hue angles without being significantly affected by lighting levels. This approach is important because in real conditions, environmental lighting often changes, such as indoors or outdoors during the day and evening. The use of Python and the OpenCV library also facilitates the implementation of color detection algorithms with efficient computation time and interactive visualization results in real time. The research method was conducted experimentally using a laptop camera as video input, then each image frame was converted to the HSV color space. Next, a masking process was performed by determining the lower and upper limits of certain colors so that colored objects could be recognized. This stage is important to ensure that the system can recognize specific areas in the image that contain the target color. By creating an HSV range (threshold) for each color, the system will only display areas that match those criteria. This technique is often used in object tracking and color segmentation applications in the field of computer vision. The results of the study show that the system is able to accurately detect red, green, and blue objects with a success rate above 90% under normal lighting conditions. This system can be applied in robotics, surveillance systems, and computer vision-based industrial applications. This success demonstrates the great potential of the HSV method in various fields. In robotics, for example, color detection is used for autonomous navigation or path tracking. In surveillance systems, color can be an indicator of certain things, such as identifying dangerous objects. Meanwhile, in industry, this system can be used to separate products based on color in automated production lines.