Some OpenCV Colour and Object Detection

In the past two years that we've competed we've had to forfeit the computer vision challenges as we've not had time to complete the code and testing required to get good enough results, but we are determined to compete in every challenge for Pi Wars 2020.

I feel that the computer vision challenge for Pi Wars 2020 (eco-disaster) is likely to be the biggest challenge in terms of the complexity of code. There's always the temptation to take somebody else's publicly shared code and modify it to suit, such as the brilliant examples available from and whilst there's absolutely nothing wrong with that, I generally like to write everything from scratch (where sensibly possible) to ensure I have a full understanding of all of the code in use. Of course, this approach is often the long way round and can be more frustrating at times, but for me I feel the end result is often better.

It's taken a few days, but today we've managed to get the robot to identify 4 different colours (red, green, blue and yellow) and identify the size of the objects it's detected, albeit in a fairly crude way, but it's a reasonable start.

There's still quite a lot of work to do, including building a way to easily calibrate the colour detection range, but we're working on that. At the moment the setting of the colour detection range is a totally manual process and whilst we've got it working pretty well (see below), we do want to make sure it can be easily adjusted on the day. 

Barrels With The Robot Lights Off

Barrels With The Robot Lights On

Comments are closed