hand pose estimation system based on Qian et al., 2014. which uses single depth maps. This system is implemented in Windows; however, it can also be compiled in Linux.
#DEPENDENCIES:
- MinGW (g++ 4.8.0)
- OpenCV 3.0
- Armadillo (with OpenBLAS)
- OpenGL
Download mingw-64 builds from here then install. It is recommended to install mingw at a short directory without spaces in its path, e.g. C:\mingw
. Remember to add MINGW_INSTALL_DIR\bin
to the PATH
environment variable on Windows. Refer to these notes for more detailed instructions. g++ V4.8.0 is used as our compiler, but later version should also work.
It is also recommended to install git for windows (e.g. in C:\mingw
), which can be downloaded from here. After the installation, git-bash should appear in the start menu. Link git-bash with mingw by adding export PATH=MINGW_INSTALL_DIR/bin:$PATH
to the file GIT_INSTALL_DIR\etc\bash.bashrc
. Check this is working by opening a new git-bash shell and calling g++ --v
.
OpenCV must be compiled from source. Downloading precompiled binaries most likely will not link with the mingw compiler (i.e. g++ V4.8.0).
To compile OpenCV, CMake is needed. Download binary from here and install. No need to add CMAKE_INSTALL_DIR\bin
to PATH
. Eigen (a linear algebra library) is also needed. This is a header only library; hence to install, simply download source and extract.
Then, clone the OpenCV source by running git clone git://github.com/Itseez/opencv.git
in a git-bash shell. This may take a while depending on internet speed.
Once this is done, follow these instructions to configure CMake. Take note that:
- Instead of choosing
Visual Studio ...
as generate, useEclipse mingw makefiles
. Then,specify native compilers
by pointing togcc
,g++
andgfortran
, which are inMINGW_INSTALL_DIR\bin
. - IMPORTANT: do not select
with Qt
- do not select
build_opencv_python
- TBB is optional; if you want to include TBB, then refer to their instructions
- IMPORTANT: set
CMAKE_BUILD_TYPE
toRelease
- change
CMAKE_INSTALL_PATH
; (I set this toMINGW_INSTALL_DIR\opencv
so everything is in one parent directory)
After the configuration and the makefiles are generated, then open git-bash at the directory where you specified to build the binaries. Then execute:
mingw32-make
This will take a while. Once it's finished without throwing any errors, then run:
mingw32-make install
Which will install OpenCV to CMAKE_INSTALL_DIR
. Finally, remember to include OPENCV_INSTALL_DIR\bin
to PATH
.
Armadillo is also a header only linear algebra library that provides MATLAB-like syntaxes. Here, I will run through instructions for installing Armadillo with OpenBLAS, which is a fast BLAS library.
- Compile OpenBLAS to
MINGW_INSTALL_DIR
by following instructions here - Compile Lapack to
MINGW_INSTALL_DIR
by following instructions [here], CMake is needed; and it is better to compile using the same g++ than downloading the precompiled binaries - Download and extract aramdillo source from here
- Setup CMake using the same process as for OpenCV; make sure that CMake can find LAPACK and OpenBLAS
- Compile and install using
mingw32-make
Test that the installation is fine by running ARMADILLO_SOURCE/examples/example1.cpp
. The instructions to compile this example can be found in the README file.
IMPORTANT: our implementation can be parallelised on runtime by enabling OpenMP on runtime. This will conflict with OpenBLAS's multithreading and cause errors. To avoid this, add the environment variable OPENBLAS_NUM_THREADS
and set to 1.
In mingw we need to install GLUT separately. Detailed instructions can be found here.
I used Eclipse for development. To install Eclipse and setup for C++, follow these instructions.
#DATA:
The data set can be found here. Subject1 data is used in our system. Place the depth map files in ../handModelling/Release_2014_5_28/Subject1/
. Alternatively, modify the search paths in testmodel.cpp
and visualiser.cpp
.
The hand geometries (i.e. joint lengths and hand spheres radii) are predefined and they are stored in the .bat files in \misc
. So, using another subject will likely degrade performance as subjects' hand geometries are different.
Firstly, ensure that all dependencies are installed and the test data is in the proper directory.
Then after cloning this repo and importing it to eclipse, setup project properties by:
- right click on project and go to
Properties
- expand
C\C++ Build
and selectSettings
- OPTIONAL: in
GCC C++ COMPILER
andMinGW C++ Linker
add to the Command box-fopenmp
to enable parallelism (make sure then to turn off OpenBLAS's multithreading) - in
Includes
underGCC C++ COMPILER
, add the include paths -I for ALL installed dependencies (since I installed everything inMINGW_INSTALL_DIR
, then I only needed to addMINGW_INSTALL_DIR\include
) - OPTIONAL: in
Optimisation
underGCC C++ COMPILER
set the optimisation level - in
Libraries
underMinGW C++ Linker
, add to Libraries -l:- armadillo
- openblas
- lapack
- opencv_coreXYZ (where XYZ is the version of OpenCV you installed)
- opencv_imgprocXYZ
- opencv_flannXYZ
- opencv_features2dXYZ
- opencv_highguiXYZ
- opencv_imgcodecsXYZ
- opengl32
- glu32
- freeglut
- in
Libraries
underMinGW C++ Linker
, add the lib paths of all installed dependencies to Library search path -L (again, since I have installed everything underMINGW_INSTALL_DIR
, I only needed to addMINGW_INSTALL_DIR\lib
) - finally build project and run as local C++ application; a few different tests are available in
testmodel.cpp