I believe everyone who working with Human Action Recognition will familiar with mid-level feature extraction which is state-of-the-art for handcrafted: Dense Trajectory (DT) and Improve Dense Trajectory (IDT) . Unfortunately this method not available in matlab. From my experience, I took 3 weeks to learn how to install and run this method from scratch. I don't want you guys also have same experience with me.
This session will be divide into three parts: (1) Installation Virtual Box (VB) and Ubuntu 12.04.05 (2) Installation of ffmpeg 0.11.1 and OpenCV-2.4.2 (3) Compilation.
For DT and IDT we refer to the authors Heng Wang link.
(1) VB and Ubuntu 12.04.05. You guys can exactly follow this tutorial: Virtual-Box_Ubuntu-12.04.5. Virtual box is virtual machine that can be a medium to use another operating system (OS) instead of Windows. This will bring you in easy way to use other OS instead of install and remove current OS. Notes: You can install android, mac or others window version also if you want, by using VB. This is the result, after you successfully install both environment.
(2) ffmpeg 0.11.1 and OpenCV-2.4.2. For this part, I follow the tutorial from here. Please take note, you cannot simply follow all the instruction because some of the files are expired. For guide purpose please follow my instruction here . (I'm using 64bit):
(a) Remove any installed versions of ffmpeg and x264.
sudo apt-get remove ffmpeg x264 libx264-dev
(b) Get all the dependencies for x264 and ffmpeg.
(c) Download and install gstreamer.sudo apt-get update
sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev
(d) Download and install libjpeg.sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg
sudo apt-get install libjpeg8 libjpeg8-dev(e) Create a directory (mkdir) to hold source code.
(f) Download and install install x264.cd ~
mkdir src
(i) Download a recent stable snapshot of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/. The
exact version does not seem to matter. To write this guide, I used version x264-snapshot-20120528-2245-
stable.tar.bz2, but I have used previous versions too.
cd ~/src
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120528-2245-stable.tar.bz2
tar xvf x264-snapshot-20120528-2245-stable.tar.bz2cd x264-snapshot-20120528-2245-stable
(ii). Configure and build the x264 libraries (with enable shared and enable pic).
./configure --enable-static --enable-shared --enable-pic
make
sudo make install
(g) Download and install ffmpeg. Don't use the link provide by reference because it's already outdated.
(i) You can use this link: https://lear.inrialpes.fr/people/wang/download/ffmpeg-0.11.1.tar.bz2
cd ~/srcwget https://lear.inrialpes.fr/people/wang/download/ffmpeg-0.11.1.tar.bz2tar xvf ffmpeg-0.11.1.tar.bz2cd ffmpeg-0.11.1
(ii) Configure and build ffmpeg
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic(iii) Install the file
makesudo make install
(h) Download and install install a recent version of v4l (video for linux) from http://www.linuxtv.org/downloads/v4l-utils/. For this guide I used version 0.8.8.
cd ~/src
wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-0.8.8.tar.bz2
tar xvf v4l-utils-0.8.8.tar.bz2
cd v4l-utils-0.8.8
make
sudo make install
(i) Download and install install OpenCV 2.4.2. Don't use the link provide by reference because it's already outdated.
(i) You can use this link: https://lear.inrialpes.fr/people/wang/download/OpenCV-2.4.2.tar.bz2
cd ~/src
wget https://lear.inrialpes.fr/people/wang/download/OpenCV-2.4.2.tar.bz2tar xvf OpenCV-2.4.2.tar.bz2
(ii) Create a new build directory and run cmake:
(iii) Verify that the output of cmake includes the following text:cd OpenCV-2.4.2/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
- found gstreamer-base-0.10
- GTK+ 2.x: YES
- FFMPEG: YES
- GStreamer: YES
- V4L/V4L2: Using libv4l
(iv) Build and install OpenCV.
make
sudo make install
Until here if everything okey. You can check the ffmpeg installation by simply type : ffmpeg . If the installation was perfect, it will show what version that are using and no error.
The rest is little bit tricky, but don't worry you can follow my step:
(j) Download the DT/IDT file and make it available, (make sure, you still is src directory):
wget https://lear.inrialpes.fr/people/wang/download/improved_trajectory_release.tar.gz
tar xvf improved_trajectory_release.tar.gz
make
Note: change to the DT link if you want to download DT
(k) We want to add the opencv library into path. Go back to home directory by simply type:
cdNext, you need to add path into /.bashrc. What is ./bashrc? This is the file that will link your path automatically without you declare it first every time you want to do your work. In addition, I put all the directory need which is: (1) sharelibrary (2) pkgconfig (3) IDT/DT trajectory
gedit ~./bashrcOnce the text appear. Add this text below to the tail script of the .bashrc file.
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfigexport PKG_CONFIG_PATHexport LD_LIBRARY_PATH=/usr/local/libexport PATH="$HOME/src/improved_trajectory_release:$PATH
Finish and congratulations for successfully install our working station. After you done, just click save and close the text. Someone told me, that you need to restart, after this process, I don't have a time to argue. So I just follow.
(3) Compilation.
(a) For compilation, we do all the thing from the terminal. First we go the
improved_trajectory_release folder by type this following script on terminal:
cd src
cd improved_trajectory_release
(b) Making the text is available to execute. Please type
chmod a+x DenseTrackStab.cpp
chmod a+x Video.cpp
This will bring the text are ready to execute. You can check by simply type list:
lsif the text became green, then it is ready to execute. I also put video person01_boxing_d1_uncomp.avi outside from test_sequences library
(c) To run the file, we can test Video.cpp text. You need to change this text into binary text first.
g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib/ -g -o Video Video.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_stitching
(d) Then run the text below:
./Video person01_boxing_d1_uncomp.avi
After you run this code, you can play the video. After that, to use DenseTrackStab.cpp, just replace Video Video.cpp into DenseTrackStab DenseTrackStab.cpp into the text in (3)(c)
If you wan to use the other video, you need to change the formation of video from whatever type. ie: mp4 to avi.
For example, if I has cartoon.mp4 file in the directory src, I can simply type:
ffmpeg -i cartoon.mp4 cartoon.avi
It will definately change to the avi format.
Hope, this tutorial will help you guys. If you guys face any hesitation, please put the comment below or email me msrizal2012@gmail.com. Many thanks.
-----------------------------------
Additional Link:
(1) https://github.com/chuckcho/iDT
No comments:
Post a Comment