- Operating Systems
- Requirements
- Clone and Update the Repository
- Installation
- Reinstallation
- Optional Settings
- Ubuntu 14 and 16.
See doc/quick_start.md#requirements.
See doc/quick_start.md#clone-and-update-the-repository.
The instructions in this section describe the steps to build OpenPose using CMake (GUI). There are 3 main steps:
By default, OpenPose uses Caffe under the hood. If you have not used Caffe previously, install its dependencies by running:
bash ./ubuntu/install_cmake.sh
Note: If you prefer to use CMake though the command line, see Cmake Command Line Build.
-
Install CMake GUI.
- Ubuntu: run
sudo apt-get install cmake-qt-gui
. - Windows: download and install the latest Windows win64-x64 msi installer from the CMake website.
- Ubuntu: run
-
Open CMake GUI and select the project source directory and a sub-directory where the Makefiles will be generated. We will first select the openpose directory and then we will select a
build
directory in the project root directory as shown in the image below (See the red rectangle). If thebuild
directory does not exists, CMake will create it.
- Next press the
Configure
button in the GUI. It will first ask you to create thebuild
directory, if it already did not exist. PressYes
.
- Next a new dialog box will appear, press the
Finish
button here.
- If this step is successful, in the bottom box it will show "Configuring done" (in the last line) as shown below.
- Press the
Generate
button and proceed to OpenPose Building.
Note: If you prefer to use your own custom Caffe or OpenCV versions, see Custom Caffe or Custom OpenCV respectively.
Finally, build the project by running the following commands.
cd build/
no_cores=`cat /proc/cpuinfo | grep processor | wc -l`
make -j${no_cores}
Check OpenPose was properly installed by running it on the default images, video or webcam: doc/quick_start.md#quick-start.
In order to re-install OpenPose:
- Delete the
build/
folder. - In CMake GUI, click on
File
-->Delete Cache
. - Follow the Installation steps again.
You can generate the documentation by setting the BUILD_DOCS
flag.
We only modified some Caffe compilation flags and minor details. You can use your own Caffe distribution, simply specify the Caffe include path and the library as shown below. You will also need to turn off the BUILD_CAFFE
variable.
If you have built OpenCV from source and OpenPose cannot find it automatically, you can set the OPENCV_DIR
variable to the directory where you build OpenCV.
By default, the body MPI model is not downloaded. You can download it by turning on the DOWNLOAD_MPI_MODEL
.
Note that this step is unnecessary if you already used the CMake GUI alternative.
Create a build
folder in the root openpose folder, where you will build the library --
cd openpose
mkdir build
cd build
The next step is to generate the Makefiles. Now there can be multiple scenarios based on what the user already has e.x. Caffe might be already installed and the user might be interested in building OpenPose against that version of Caffe instead of requiring OpenPose to build Caffe from scratch.
In the build directory, run the below command --
cmake ..
In this example, we assume that Caffe and OpenCV are already present. The user needs to supply the paths of the library to CMake. For OpenCV, specify the OpenCV_DIR
which is where the user build OpenCV. For Caffe, specify the include directory and library using the Caffe_INCLUDE_DIRS
and Caffe_LIBS
variables. This will be where you installed Caffe. Below is an example of the same.
cmake -DOpenCV_DIR=/home/"${USER}"/softwares/opencv/build \
-DCaffe_INCLUDE_DIRS=/home/"${USER}"/softwares/caffe/build/install/include \
-DCaffe_LIBS=/home/"${USER}"/softwares/caffe/build/install/lib/libcaffe.so -DBUILD_CAFFE=OFF ..
If Caffe is not already present but OpenCV is, then use the below command.
cmake -DOpenCV_DIR=/home/"${USER}"/softwares/opencv/build