Colour Detection in HSV

Hi,

Today, I tried detecting the puck using OpenCV's built-in algorithms to detect a specified colour within the camera frame.

Methods used:

1. Applied Gaussian Blur to blur the frame to remove small noises within the camera frame.
2. Converted OpenCV's default colour format from BGR to HSV which allowed the camera to detect a range of a specified      colour e.g. from light red to dark red.
3. Used trackbars to recognise the colour of the puck in real-time. I plan on using the values found in this test script in my       final script where I don't have to change anything. 3 trackbars were moved to control Hue, Saturation and Value of the         lower range of red, whilst the other 3 trackbars is to control the higher range of red.

Video of a simple red colour detection by manually finding HSV values

As shown in the video above, the camera cannot detect the red puck very well. One of the main reason is the glossy finish of the puck which is difficult to pick up especially with several spot lights located directly above the table. In addition, the table's design contains a red box which appears as a noise in the Mask window. Therefore, I need to use a puck with a unique colour to stop detecting unwanted objects.

Video of a simple green colour detection

In the video above, I have printed out a green circle and attached it onto the puck. The camera picks up the puck very well considering the spot light above the table. Although, as the puck is translated around the table, the accuracy of the detection decreases in relation to the brightness of the light. This problem may also result of the shadow that the camera stand have produced.

After using my phone to provide light directly on the puck, the puck was more visible in the Mask window. To counter the problem of lighting condition faced in this test, I have concluded that the table must be within certain lighting conditions and should have the same lighting throughout i.e. Not have different lighting conditions in different regions within the camera frame.

Immanuel

Comments

Popular posts from this blog

Introduction

Test - Relationship between Accuracy and Angle