Blog of things

OpenCV baby steps 5b: Tweaking HSV masks using Morphological transformations

2018-7-19

Well I did think I'll get to blogging so quickly again, but I am currently 'marooned' at one of the most scenic places on earth - Columbia Ice Fields, Jasper, Canada. Our bus has been impounded by the DoT and we are waiting for a replacement. I've done the nearby hikes and now sitting around in a sun lounger. This was too good a place to not write some code or write about code 🤓. So today I'll just add a couple of lines of code to our previous application, that will improve the HSV mask and make the circles more contiguous.

read more

OpenCV baby steps 5: Tracking multiple colours

2018-7-17

Sorry, its been a while since I took my last baby step. I have been in the midst of a few things and funnily enough, as I start typing this, I am actually holidaying in Canada. The drive from Vancouver to Kamloops is very very scenic :D. Eitherways, learning never stops, holidaying or not. I have been struggling to go ahead with my plans to track multiple coloured objects in the same frame. I mean in the last post we saw how we can identify four coloured balls using HSV masking. Also in step 3 we saw how to detect circles using OpenCV's HoughCircles function. What I wanted was a combination of the two - Detect position of a ball of my choice e.g. Red ball is placed here (x,y,radius). Turns out it was my lack of Python knowledge than OpenCV that got in the way. OpenCV continues to amaze me for its versatility and ease of use.

read more

OpenCV baby steps 4: Building a HSV calibrator

2018-6-26

So far we have taken small bits of OpenCV goodness and explored them independently. Today we are going to see how we can combine a few things together and build ourselves a small app that helps us convert a coloured image into its Hue, Saturation and Value equivalent, and then adjust the HSV range to isolate one or more colours in the image.

read more

Open CV Baby steps 3: Circle detection

2018-6-19

So far we have seen how to install OpenCV and capture images from a video stream. Today we'll see how we can detect circles (or balls) in an image. Last year, the biggest challenge of PiWars was to be able to detect coloured balls kept on four corners of an arena and drive a robot towards it. Now I don't know if they will have the same challenge this year, however we can use this as a starting point to use a few more OpenCV tricks. Today we'll learn about how to use Hough transforms in OpenCV and how we can use it to detect balls in an image.

read more

Open CV Baby steps 2: Capturing video frames

2018-6-18

In the introductory post we saw how to setup OpenCV on a Raspbian (Desktop) and run a small sample application to convert an image into greyscale. Today we'll see how easy it is to capture frames from a camera and write some text on to each frame and save them.

read more