cvBlob is a library for computer vision to detect connected regions in binary digital images. cvBlob performs connected component analysis and features extraction. Before you start to install cvBlob, you must ensure Raspberry Pi has installed OpenCV-2.4.2. cvBlob can help you to detect color blob quickly, cvBlob is writen using C++.

Let’s start:

1. Download cvBlob source code

$ cd /home/pi
$ wget

2. Extract cvBlob Source

$  tar -zxvf cvblob-0.10.4-src.tgz

3. Go to extracted cvBlob folder and modify code

$ cd /home/pi/cvblob/cvBlob

The original cvBlob is not compitable with the current OpenCV version 2.4.2, we need to change some source code in order to compile successfully. Open cvlabel.cpp and find lines 30 and 40, manually change:

const  char  movesE … 
const  char  movesI  … 


const  signed  char  movesE … 
const  signed  char  movesI  … 

Once you changed code, save cvlabel.cpp and go back to Terminal.

4. Configure cvBlob build by running cmake

$  cmake . -DOpenCV_DIR=/home/pi/OpenCV-2.4.2/release

5. Compile by using make and install

$ make
$ sudo make install 

The following image shows the installation process:

cvblob install

6. Reboot your Pi

$ sudo reboot

7. cvBlob Testing

Connect usb webcam to your Pi.

$ cd /home/pi/cvblob/samples
$ make
$ ./red_object_tracking

If you see “error while loading shared libraries:”, you should:

$ echo "/usr/local/lib" >> /etc/ 
$ ldconfig

If red_object_tracking can run, it means that you have successfully installed cvBlob, this example code provide one color detection(VERY GOOD), it’s similar to my single color detection.