Mateusz Stankiewicz "I see what you did there"


Instant OpenCV Starter – a few thoughts

Courtesy of Packt Publishing

Instant OpenCV Starter

Lately I was given an opportunity to read a book about OpenCV called (very accurately) Instant OpenCV Starter. The book does exactly what the says - it's a short introduction to everyone's favorite Computer Vision library.

The book itself contains a few sections worth mentioning. First part about installation contains great explanation how to install OpenCV (2.4.2) on Ubuntu (12.04 LTS) and configure it within Code::Blocks. There is also a part about Windows installation, but it falls a little short. Mainly because it is, well...short in comparison to Linux counterpart.

The most interesting part is one called "Top 5 features you need to know about" and it covers things like pixel manipulation, image resizing or edge detection. The features are nicely organized into tasks, which states a problem (e.g. reading and displaying an image) and shows the solution. All code has very detailed explanations, but there is very little theory. For example in task regarding edge detection the Canny Edge Detector is used but there is no mention about morphological operations or even what Canny exactly does. It just states a problem and gives you a straightforward solution without going into theoretical reflections, which sometimes is good but it isn't very helpful in understanding the topic.

Filed under: Books, OpenCV Continue reading

Code Snippet: Create mosaic from images

Quite a long time since last update - mostly due to lots of work (and to be honest, Mass Effect :) ). This time I will show you a little and handy fragment of code for merging a few pictures into one. This way there is no need to create a lot of windows, which in my opinion are not exactly a very convienient way to look up, let's say about 16 pictures at once.

5x5 mosaic5x3 mosaic

Here you can see the effect that we achieve. Now let's see the code!


Tutorial: Background detection with OpenCV

UPDATE: This tutorial is written for OpenCV 2.3 and as one of the commenters pointed out, from OpenCV 2.4 the nmixtures are protected instead of public, so you might have to set the values for nmixtures and bShadowDetection using the constructor.

This is a first post from what hopefully will become series of tutorials so stay tuned. Those tutorials aren't exactly intended for complete beginners, although I try to explain as much things as possible. I presume that you have at least basic grasp of C++ and have already configured OpenCV. Some knowledge about image processing also would help.

Lately, as a part of bigger project, I needed to detect a background in quite precise way. I didn't have time to write my own background estimation algorithm or reimplement existent, so I decided to use functions from OpenCV - the results are very good with very little effort (the code is about 35 lines long). The program itself does background, foreground segmentation and draws nice contours around detected foreground objects.


Qt + OpenCV + OpenGL – Image overlay v2

Here is a little app that (again) overlays the (same) image over the chessboard, but this time I used a QT/OpenGL interface to show and overlay image. The OpenCV still takes care about image acquisition and checkboard detection. Using OpenGL textures made overlaying really easy.

The project could come handy as a tutorial how to integrate QT, OpenGL and OpenCV. Also it is a nice demonstration that algebra has some real life applications (displaying cat images on chessboards obviously).

Some time later I will write a decent tutorial how to do integrate mentioned libraries, because googling it really does not give simple answer, so stay put. In the meantime have a look at the source code.

The next step is true augmented reality with 3D objects and other cool things :)

Tagged as: , , 2 Comments

Overlaying an image using OpenCV

A little app written using OpenCV. It uses OpenCV camera callibration module to find a chessboard and then overlays a custom image.

As a reference I based on a project from this page, although loosely, because that program has been written for OpenCV 1.X. I rewrote it to use newer version and now it works using OpenCV 2.3. Nevertheless the page is worth visiting. I omitted the bitwise operations in my app, because the effect wasn't what I imagined and I wrote my own function which does image merging. It needs to be improved, but that's an early version of an app that was written for fun :)

See for yourself how it works:

Here's the project source (I used QT Creator - quite convenient once configured).

Tagged as: , 1 Comment