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 Pi has installed OpenCV-2.4.2. cvBlob can help you to detect color blob quickly, because cvBlob is writen by C++, so your code must be .cpp format.
1. Download cvBlob source
$ cd /home/pi $ wget http://cvblob.googlecode.com/files/cvblob-0.10.4-src.tgz
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
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 LXTerminal.
$ cd /home/pi/cvblob
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
$ sudo reboot
7. cvBlob Testing
Connect webcam to your Pi
$ cd /home/pi/cvblob/samples $ make $ ./red_object_tracking
If you see “error while loading shared libraries: xxx.so”, you should:
$ echo "/usr/local/lib" >> /etc/ld.so.conf $ ldconfig
If red_object_tracking can run, means that you have successfully installed cvBlob, this example code provide one color detection(VERY GOOD), it’s similar to my single color detection.
Have a good night!