This install process includes the ffmpeg libraries, and takes you from a basic Fedora 8 box to running the facedetect example.
Install ffmpeg
Do this as root.
* yum install SDL-devel
* From ffmpeg, download a full checkout.
* tar xjf ffmpeg-checkout-snapshot.tar.bz2
* cd ffmpeg-checkout-2008-10-28 (or whatever release yours is)
* ./configure --enable-shared --enable-swscale --enable-gpl
* make (You'll have time to get coffee, maybe see a movie, while this runs.)
* make install
* echo "/usr/local/lib" >/etc/ld.so.conf.d/ffmpeg.conf
* ldconfig
Now, run ffplay and pass it the name of a local video file - flv, avi, whatever.
Install OpenCV
You're still root, yes?
* yum install gtk2-devel
* Download http://downloads.sourceforge.net/opencvlibrary/opencv-1.1pre1.tar.gz
* cd /tmp
* tar xzf opencv-1.1pre1.tar.gz
* cd /usr/local/include/
* mkdir ffmpeg
* cd ffmpeg
* find ../ -name "*.h" | xargs -n1 ln -s
* cd /tmp/opencv-1.1.0/
* ./configure --enable-apps --enable-shared --with-ffmpeg --with-gnu-ld --with-x --without-quicktime CXXFLAGS=-fno-strict-aliasing CFLAGS=-I/usr/local/include/ffmpeg CPPFLAGS=-I/usr/local/include/ffmpeg LDFLAGS=-L/usr/local/lib
You should see
...
Use gtk+ 2.x: yes
Use gthread: yes
...
Use ffmpeg: yes
...
* make
* make install
Now, to verify that everything's good.
facedetect
You can do this as an ordinary user in your home directory. You'll need an avi to use, in the place of /shared/public/videos/dove_hires.avi, but I'll leave it up to you to go find one.
* mkdir face
* cd face
* rsync -a /tmp/opencv-1.1.0/samples/c/ .
* g++ facedetect.c -o facedetect -I /usr/local/include/opencv/ -L /usr/local/lib/ -lm -lcv -lhighgui -lcvaux
* ./facedetect --cascade="/tmp/opencv-1.1.0/data/haarcascades/haarcascade_frontalface_alt2.xml" /shared/public/videos/dove_hires.avi
You should see the video play, with facedetect drawing a red circle around anything it thinks is a face. Cool stuff!
No comments:
Post a Comment