Wednesday, October 3, 2012

Robot Life, Vol 2

Robots ahoy! Some new image processing tests and opencv tests! Since the last post, I did some more manual testing and moved to opencv to experiment with more image filters for vision processing.

After performing basic image processing with Sobel and Bilateral filters, we have a good image to process with a Hough Transform. This allows us to extract lines from an image which we can then reconstruct into geometrical shapes. Here we have a sample picture (ref) showing what the algorithm produces, and an application of it to a low-res Random Internet Photo.

sample hough transform

hough transform test

The Hough Transform is really quite cool. It maps lines in cartesian space to lines expressed as polar coordinates by writing out sinusoids in Hough Space. Where many of these sinusoids overlap you have a strong candidate polar coordinate for a line in your image. Super rad. Here are some of the better papers I found describing it: 123456.

However, the results of the Hough Transform require careful coefficient tuning and so is not as robust as we would hope. Some OpenCV testing lets us chain much more variety and find a better set of image transforms to extract the desired polygonized shapes.

After experimenting with a lot of combinations I settled on a Bilateral + Canny filter to get shape outlines and then performed polygonization on this image. Having a larger number of iterations on the Bilateral filter was more beneficial than an additional Sobel filter or Box/Gaussian blur. The polygonization step with a low/high angle threshold is also shown here.

opencv tests

Looks like a good start to the sort of data we want. Here it is running real-time, on a low-res image feed. The colors indicate unique polygons, but it is randomized each frame so it changes color erratically!

Testing with OpenCV gave a much faster turnaround time, though manual implementation is fun and educational. There were a lot of combinations of filters and settings that gave poor results before reaching this. It is vital to have real-time parameter tuning so you can find the right set of filters+tunings for your needs.

Things are busy so I'm currently on a tangent doing some smaller audio processing experiments for some fun applications with Nao. Till next time!

No comments:

Post a Comment