installation.md 22.5 KB
Newer Older
G
Gines 已提交
1 2
OpenPose - Installation
==========================
G
gineshidalgo99 已提交
3

4
## Contents
5 6
1. [Windows Portable Demo](#windows-portable-demo)
2. [Operating Systems](#operating-systems)
7
3. [Requirements and Dependencies](#requirements-and-dependencies)
8 9 10 11 12 13
4. [Clone OpenPose](#clone-openpose)
5. [Update OpenPose](#update-openpose)
6. [Installation](#installation)
7. [Reinstallation](#reinstallation)
8. [Uninstallation](#uninstallation)
9. [Optional Settings](#optional-settings)
G
Gines Hidalgo 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26
    1. [Maximum Speed](#maximum-speed)
    2. [COCO and MPI Models](#coco-and-mpi-models)
    3. [Python API](#python-api)
    4. [CPU Version](#cpu-version)
    5. [OpenCL Version](#opencl-version)
    6. [Mac OSX Version](#mac-osx-version)
    7. [3D Reconstruction Module](#3d-reconstruction-module)
    8. [Calibration Module](#calibration-module)
    9. [Compiling without cuDNN](#compiling-without-cudnn)
    10. [Custom Caffe (Ubuntu Only)](#custom-caffe-ubuntu-only)
    11. [Custom OpenCV (Ubuntu Only)](#custom-opencv-ubuntu-only)
    12. [Doxygen Documentation Autogeneration (Ubuntu Only)](#doxygen-documentation-autogeneration-ubuntu-only)
    13. [CMake Command Line Configuration (Ubuntu Only)](#cmake-command-line-configuration-ubuntu-only)
G
gineshidalgo99 已提交
27 28 29



30 31 32
## Windows Portable Demo
This installation section is only intended if you plan to modify the OpenPose code or integrate it with another library or project. If you just want to use the OpenPose demo in Windows, simply use the latest version of the OpenPose binaries which you can find in the [Releases](https://github.com/CMU-Perceptual-Computing-Lab/openpose/releases) section.

G
gineshidalgo99 已提交
33 34
**NOTE**: Read the `Instructions.txt` to learn to download the models required by OpenPose (about 500 Mb).

35 36


G
gineshidalgo99 已提交
37
## Operating Systems
G
Gines Hidalgo 已提交
38 39
- **Ubuntu** 14, 16, 18.
- **Windows** 7, 8, 10. Note: Only CUDA 8 and graphic cards up to 10XX series. **20XX series and V100 graphic cards are not compatible yet** (check GitHub issue #996 for updates).
R
Raaj 已提交
40
- **Mac OSX** Mavericks and above.
G
gineshidalgo99 已提交
41
- **Nvidia Jetson TX2** (for JetPack 3.1 or 3.3), installation instructions in [doc/installation_jetson_tx2_jetpack3.1.md](./installation_jetson_tx2_jetpack3.1.md) and [doc/installation_jetson_tx2_jetpack3.3.md](./installation_jetson_tx2_jetpack3.3.md) respectively.
42
- OpenPose has also been used on **Windows 7**, **CentOS**, and **Nvidia Jetson (TK1 and TX1)** embedded systems. However, we do not officially support them at the moment.
G
gineshidalgo99 已提交
43 44


45

G
gineshidalgo99 已提交
46 47


48 49
## Requirements and Dependencies
- **Requirements** for the default configuration (you might need more resources with a greater `--net_resolution` and/or `scale_number` or less resources by reducing the net resolution and/or using the MPI and MPI_4 models):
50
    - CUDA (Nvidia GPU) version:
51 52 53
        - NVIDIA graphics card with at least 1.6 GB available (the `nvidia-smi` command checks the available GPU memory in Ubuntu).
        - At least 2.5 GB of free RAM memory for BODY_25 model or 2 GB for COCO model (assuming cuDNN installed).
        - Highly recommended: cuDNN.
54
    - OpenCL (AMD GPU) version:
55 56
        - Vega series graphics card
        - At least 2 GB of free RAM memory.
57
    - CPU-only (no GPU) version:
58 59 60 61 62 63
        - Around 8GB of free RAM memory.
    - Highly recommended: a CPU with at least 8 cores.
- **Dependencies**:
    - OpenCV (all 2.X and 3.X versions are compatible).
    - Caffe and all its dependencies. Interesting in porting OpenPose to other DL frameworks (Tensorflow, Caffe2, Pytorch, ...)?. Email us (gines@cmu.edu) if you are interesting in joining the OpenPose team to do so or feel free to make a pull request if you implement any of those!
    - The demo and tutorials additionally use GFlags.
G
gineshidalgo99 已提交
64 65


G
gineshidalgo99 已提交
66 67


68 69


G
Gines 已提交
70 71 72 73 74
## Clone OpenPose
The first step is to clone the OpenPose repository.

1. Windows: You might use [GitHub Desktop](https://desktop.github.com/).
2. Ubuntu:
G
Gines 已提交
75 76 77 78 79
```bash
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
```


G
gineshidalgo99 已提交
80 81


82

G
Gines 已提交
83 84
## Update OpenPose
OpenPose can be easily updated by:
85

G
Gines 已提交
86 87 88 89
1. Download the latest changes:
    1. Windows: Clicking the `synchronization` button at the top-right part in GitHub Desktop in Windows.
    2. Ubuntu: running `git pull origin master`.
2. Perform the [Reinstallation](#reinstallation) section described below.
90

G
gineshidalgo99 已提交
91 92 93 94




G
Gines 已提交
95 96
## Installation
The instructions in this section describe the steps to build OpenPose using CMake (GUI). There are 3 main steps:
G
gineshidalgo99 已提交
97

G
gineshidalgo99 已提交
98 99 100 101 102 103 104 105 106 107 108
1. [Problems and Errors Installing](#problems-and-errors-installing)
2. [Prerequisites](#prerequisites)
3. [OpenPose Configuration](#openpose-configuration)
4. [OpenPose Building](#openpose-building)
5. [Run OpenPose](#run-openpose)
6. [OpenPose from other Projects (Ubuntu and Mac)](#openpose-from-other-projects-ubuntu-and-mac)



### Problems and Errors Installing
Any problem installing OpenPose? Check [doc/faq.md](./faq.md) and/or post a GitHub issue. We will not respond more GitHub issues about Caffe, OpenCV or CUDA errors.
G
gineshidalgo99 已提交
109

110 111


112
### Prerequisites
G
gineshidalgo99 已提交
113
Make sure to download and install the prerequisites for your particular operating system following [doc/prerequisites.md](./prerequisites.md).
114 115


116

G
Gines 已提交
117
### OpenPose Configuration
118
1. Open CMake GUI and select the OpenPose directory as project source directory, and a non-existing or empty sub-directory (e.g., `build`) where the Makefile files (Ubuntu) or Visual Studio solution (Windows) will be generated. If `build` does not exist, it will ask you whether to create it. Press `Yes`.
G
Gines 已提交
119 120 121 122
<p align="center">
    <img src="media/cmake_installation/im_1.png", width="480">
    <img src="media/cmake_installation/im_1_windows.png", width="480">
</p>
123

124
2. Press the `Configure` button, keep the generator in `Unix Makefile` (Ubuntu) or set it to `Visual Studio 14 2015 Win64` (Windows), and press `Finish`.
G
Gines 已提交
125 126 127 128
<p align="center">
    <img src="media/cmake_installation/im_2.png", width="240">
    <img src="media/cmake_installation/im_2_windows.png", width="240">
</p>
129

130
3. If this step is successful, the `Configuring done` text will appear in the bottom box in the last line. Otherwise, some red text will appear in that same bottom box.
G
Gines 已提交
131 132 133 134
<p align="center">
    <img src="media/cmake_installation/im_3.png", width="480">
    <img src="media/cmake_installation/im_3_windows.png", width="480">
</p>
135

136
4. Press the `Generate` button and proceed to [OpenPose Building](#openpose-building). You can now close CMake.
137

G
Gines 已提交
138
Note: If you prefer to use your own custom Caffe or OpenCV versions, see [Custom Caffe](#custom-caffe) or [Custom OpenCV](#custom-opencv) respectively.
139 140


141

G
Gines 已提交
142
### OpenPose Building
G
gineshidalgo99 已提交
143
#### Ubuntu and Mac
G
Gines 已提交
144 145 146 147 148
Finally, build the project by running the following commands.
```
cd build/
make -j`nproc`
```
149

G
Gines 已提交
150 151
#### Windows
In order to build the project, open the Visual Studio solution (Windows), called `build/OpenPose.sln`. Then, set the configuration from `Debug` to `Release` and press the green triangle icon (alternatively press <kbd>F5</kbd>).
152

G
gineshidalgo99 已提交
153 154
**VERY IMPORTANT NOTE**: In order to use OpenPose outside Visual Studio, and assuming you have not unchecked the `BUILD_BIN_FOLDER` flag in CMake, copy all DLLs from `{build_directory}/bin` into the folder where the generated `openpose.dll` and `*.exe` demos are, e.g., `{build_directory}x64/Release` for the 64-bit release version.

G
Gines 已提交
155 156


157 158 159 160 161
### Run OpenPose
Check OpenPose was properly installed by running it on the default images, video, or webcam: [doc/quick_start.md#quick-start](./quick_start.md#quick-start).



G
gineshidalgo99 已提交
162
### OpenPose from other Projects (Ubuntu and Mac)
G
Gines 已提交
163
If you only intend to use the OpenPose demo, you might skip this step. This step is only recommended if you plan to use the OpenPose API from other projects.
G
Gines 已提交
164

G
gineshidalgo99 已提交
165
To install the OpenPose headers and libraries into the system environment path (e.g., `/usr/local/` or `/usr/`), run the following command.
G
Gines 已提交
166 167 168 169
```
cd build/
sudo make install
```
170

G
Gines 已提交
171 172 173
Once the installation is completed, you can use OpenPose in your other project using the `find_package` cmake command. Below, is a small example `CMakeLists.txt`. In order to use this script, you also need to copy `FindGFlags.cmake` and `FindGlog.cmake` into your `<project_root_directory>/cmake/Modules/` (create the directory if necessary).
```
cmake_minimum_required(VERSION 2.8.7)
174

G
Gines 已提交
175
add_definitions(-std=c++11)
G
gineshidalgo99 已提交
176

G
Gines 已提交
177
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
178

G
Gines 已提交
179 180 181 182
find_package(GFlags)
find_package(Glog)
find_package(OpenCV)
find_package(OpenPose REQUIRED)
183

G
Gines 已提交
184
include_directories(${OpenPose_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIR} ${GLOG_INCLUDE_DIR} ${OpenCV_INCLUDE_DIRS})
185

G
Gines 已提交
186
add_executable(example.bin example.cpp)
G
gineshidalgo99 已提交
187

G
Gines 已提交
188 189
target_link_libraries(example.bin ${OpenPose_LIBS} ${GFLAGS_LIBRARY} ${GLOG_LIBRARY} ${OpenCV_LIBS})
```
G
gineshidalgo99 已提交
190

G
Gines 已提交
191
If Caffe was built with OpenPose, it will automatically find it. Otherwise, you will need to link Caffe again as shown below (otherwise, you might get an error like `/usr/bin/ld: cannot find -lcaffe`).
192
```
G
gineshidalgo99 已提交
193
link_directories(<path_to_caffe_installation>/caffe/build/install/lib)
194 195 196 197
```



G
Gines 已提交
198 199
## Reinstallation
In order to re-install OpenPose:
G
gineshidalgo99 已提交
200
1. (Ubuntu and Mac) If you ran `sudo make install`, then run `sudo make uninstall` in `build/`.
G
Gines 已提交
201 202 203
2. Delete the `build/` folder.
3. In CMake GUI, click on `File` --> `Delete Cache`.
4. Follow the [Installation](#installation) steps again.
204

G
Gines 已提交
205 206


G
Gines 已提交
207 208
## Uninstallation
In order to uninstall OpenPose:
G
gineshidalgo99 已提交
209
1. (Ubuntu and Mac) If you ran `sudo make install`, then run `sudo make uninstall` in `build/`.
G
Gines 已提交
210
2. Remove the OpenPose folder.
G
Gines 已提交
211 212


213

G
Gines 已提交
214
### Optional Settings
G
Gines Hidalgo 已提交
215 216
#### Maximum Speed
Check the OpenPose Benchmark as well as some hints to speed up and/or reduce the memory requirements for OpenPose on [doc/speed_up_openpose.md](./speed_up_openpose.md).
G
gineshidalgo99 已提交
217 218 219



G
gineshidalgo99 已提交
220
#### COCO and MPI Models
221
By default, the body COCO and MPI models are not downloaded. You can download them by turning on the `DOWNLOAD_BODY_COCO_MODEL` or `DOWNLOAD_BODY_MPI_MODEL` flags. It's slightly faster but less accurate and has less keypoints than the COCO body model.
222

223 224
Note: Check the differences between these models in [doc/faq.md#difference-between-body_25-vs.-coco-vs.-mpi](./faq.md#difference-between-body_25-vs.-coco-vs.-mpi).

G
gineshidalgo99 已提交
225 226


G
gineshidalgo99 已提交
227
#### Python API
G
gineshidalgo99 已提交
228
To install the Python API, ensure that the `BUILD_PYTHON` flag is turned on while running CMake GUI and follow the standard installation steps. After the installation, check [doc/modules/python_module.md](./modules/python_module.md) for further details.
G
gineshidalgo99 已提交
229 230 231



G
gineshidalgo99 已提交
232 233 234
#### CPU Version
To manually select the CPU Version, open CMake GUI mentioned above, and set the `GPU_MODE` flag to `CPU_ONLY`. **NOTE: Accuracy of the CPU version is ~1% higher than CUDA version, so the results will vary.**

G
gineshidalgo99 已提交
235
- On Ubuntu, OpenPose will link against the Intel MKL version (Math Kernel Library) of Caffe. Alternatively, the user can choose his own Caffe version, by unselecting `USE_MKL` and selecting his own Caffe path.
G
gineshidalgo99 已提交
236 237
- On Windows, it will use the default version of Caffe or one provided by the user on the CPU.

G
gineshidalgo99 已提交
238
The default CPU version takes ~0.2 images per second on Ubuntu (~50x slower than GPU) while the MKL version provides a roughly 2x speedup at ~0.4 images per second. As of now OpenPose does not support MKL on Windows but will at a later date. Also, MKL version does not support unfixed resolution. So a folder of images of different resolutions requires a fixed net resolution (e.g., `--net_resolution 656x368`).
G
gineshidalgo99 已提交
239 240

The user can configure the environmental variables `MKL_NUM_THREADS` and `OMP_NUM_THREADS`. They are set at an optimum parameter level by default (i.e., to the number of threads of the machine). However, they can be tweak by running the following commands into the terminal window, right before running any OpenPose application. Eg:
R
Raaj 已提交
241

G
gineshidalgo99 已提交
242 243 244 245 246 247
```
# Optimal number = Number of threads (used by default)
export MKL_NUM_THREADS="8"
export OMP_NUM_THREADS="8"
```

G
Gines Hidalgo 已提交
248
Do note that increasing the number of threads results in more memory use. You can check the [doc/speed_up_openpose.md](./speed_up_openpose.md) for more information about speed and memory requirements in several CPUs and GPUs.
G
gineshidalgo99 已提交
249 250 251



R
Raaj 已提交
252 253 254 255 256 257 258 259 260
#### OpenCL Version
If you have an AMD graphics card, you can compile OpenPose with the OpenCL option. To manually select the OpenCL Version, open CMake GUI mentioned above, and set the `GPU_MODE` flag to `OPENCL`. **Very important:** If you compiled previously the CPU-only or CUDA versions on that same OpenPose folder, you will have to manually delete the `build` directory and run the installation steps from scratch. Otherwise, many weird errors will appear.

The OpenCL version has been tested on Ubuntu, Windows and OSX. This has been tested only on AMD Vega series and NVIDIA 10 series graphics cards. Please email us if you have issues with other operating systems or graphics cards. Running on OSX on a Mac with an AMD graphics card requires special instructions which can be seen in the section below.

Lastly, OpenCL version does not support unfixed `--net_resolution`. So a folder of images of different resolutions with OpenPose, requires the `--net_resolution 656x368` flag for example. This should be fixed by the Caffe author in a future patch.



G
gineshidalgo99 已提交
261
#### Mac OSX Version
R
Raaj 已提交
262 263 264 265 266 267 268 269 270 271 272
Mac OSX Version compiles similarly to the Ubuntu version. Take a look at the prerequisites section. For GPU acceleration, OpenPose may be built with OpenCL support (check [OpenCL Version](#opencl-version) or add in CMake`GPU_MODE=OPENCL`). If you have a Mac with an inbuilt AMD graphics card, you have to manually select your AMD GPU. To do that, first note which device your Graphics card is set under:

```
clinfo
```

Most likely, your AMD device will be under device 2. Then run openpose with the following options to use youe AMD card for acceleration.

```
build/examples/openpose/openpose.bin --num_gpu 1 --num_gpu_start 2
```
G
gineshidalgo99 已提交
273

R
Raaj 已提交
274 275 276 277 278 279 280
If you only have an integrated Intel Graphics card, then it will most probably be the device 1:

```
build/examples/openpose/openpose.bin --num_gpu 1 --num_gpu_start 1
```

Also as a side note, if the default installation fails (i.e., the one explained above), instal Caffe separately and set `BUILD_CAFFE` to false in the CMake config. Steps:
G
gineshidalgo99 已提交
281 282 283 284
- Re-create the build folder: `rm -rf build; mkdir build; cd build`.
- `brew uninstall caffe` to remove the version of Caffe previously installed via cmake.
- `brew install caffe` to install Caffe separately.
- Run `cmake-gui` and make the following adjustments to the cmake config:
285 286 287 288
    1. `BUILD_CAFFE` set to false.
    2. `Caffe_INCLUDE_DIRS` set to `/usr/local/include/caffe`.
    3. `Caffe_LIBS` set to `/usr/local/lib/libcaffe.dylib`.
    4. Run `Configure` and `Generate` from CMake GUI.
G
gineshidalgo99 已提交
289

R
Raaj 已提交
290 291 292
You may also have to apply the following patch if you have the latest OSX 10.14. It can be done as follows:

`cd 3rdparty/caffe; git apply ../../scripts/osx/mac_opencl_patch.txt`
G
gineshidalgo99 已提交
293 294


295
#### 3D Reconstruction Module
G
Gines 已提交
296
You can include the 3D reconstruction module by:
G
gineshidalgo99 已提交
297

298
1. Install the FLIR camera software, Spinnaker SDK. It is a propietary software, so we cannot provide direct download link. Note: You might skip this step if you intend to use the 3-D OpenPose module with a different camera brand.
G
Gines 已提交
299 300 301 302 303 304 305
    1. Ubuntu: Get and install the latest Spinnaker SKD version in their default path. OpenPose will automatically find it. Otherwise, set the right path with CMake.
    2. Windows: Donwload the latest Spinnaker SKD version from [https://www.ptgrey.com/support/downloads](https://www.ptgrey.com/support/downloads).
        - Copy `{PointGreyParentDirectory}\Point Grey Research\Spinnaker\bin64\vs2015\` as `{OpenPoseDirectory}\3rdparty\windows\spinnaker\bin\`. You can remove all the *.exe files.
        - Copy `{PointGreyParentDirectory}\Point Grey Research\Spinnaker\include\` as `{OpenPoseDirectory}\3rdparty\windows\spinnaker\include\`.
        - Copy `Spinnaker_v140.lib` and `Spinnakerd_v140.lib` from `{PointGreyParentDirectory}\Point Grey Research\Spinnaker\lib64\vs2015\` into `{OpenPoseDirectory}\3rdparty\windows\spinnaker\lib\`.
        - (Optional) Spinnaker SDK overview: [https://www.ptgrey.com/spinnaker-sdk](https://www.ptgrey.com/spinnaker-sdk).
2. Install the 3D visualizer, FreeGLUT:
G
gineshidalgo99 已提交
306
    1. Ubuntu: run `sudo apt-get update && sudo apt-get install build-essential freeglut3 freeglut3-dev libxmu-dev libxi-dev` and reboot your PC.
G
Gines 已提交
307 308 309 310 311 312 313 314 315
    2. Windows:
        1. It is automatically downloaded by the CMake installer.
        2. Alternatively, if you prefer to download it yourself, you could either:
            1. Double click on `3rdparty\windows\getFreeglut.bat`.
            2. Download [this version from our server](http://posefs1.perception.cs.cmu.edu/OpenPose/3rdparty/windows/freeglut_2018_01_14.zip) and unzip it in `{OpenPoseDirectory}\3rdparty\windows\freeglut\`.
            3. Download the latest `MSVC Package` from [http://www.transmissionzero.co.uk/software/freeglut-devel/](http://www.transmissionzero.co.uk/software/freeglut-devel/).
                - Copy `{freeglutParentDirectory}\freeglut\bin\x64\` as `{OpenPoseDirectory}\3rdparty\windows\freeglut\bin\`.
                - Copy `{freeglutParentDirectory}\freeglut\include\` as `{OpenPoseDirectory}\3rdparty\windows\freeglut\include\`.
                - Copy `{freeglutParentDirectory}\freeglut\lib\x64\` as `{OpenPoseDirectory}\3rdparty\windows\freeglut\lib\`.
316
3. Follow the CMake installation steps. In addition, set the `WITH_FLIR_CAMERA` (only if Spinnaker was installed) and `WITH_3D_RENDERER` options.
317
4. Increased accuracy with Ceres solver (Ubuntu only): For extra 3-D reconstruction accuracy, run `sudo apt-get install libeigen3-dev`, install [Ceres solver](http://ceres-solver.org/installation.html), and enable `WITH_CERES` in CMake when installing OpenPose. Ceres is harder to install in Windows, so we have not tested it so far in there. Feel free to make a pull request if you do.
G
gineshidalgo99 已提交
318

G
gineshidalgo99 已提交
319
After installation, check the [doc/modules/3d_reconstruction_module.md](./modules/3d_reconstruction_module.md) instructions.
G
gineshidalgo99 已提交
320 321 322



323
#### Calibration Module
324
The calibration module is included by default, but you must also enable `WITH_EIGEN` if you intend to use the extrinsic camera parameter estimation tool. You can set that flag to 2 different values: `APT_GET` or `BUILD`, check [Requirements and Dependencies](#requirements-and-dependencies) for more information.
325

G
gineshidalgo99 已提交
326
After installation, check the [doc/modules/calibration_module.md](./modules/calibration_module.md) instructions.
327 328 329



G
Gines 已提交
330 331
#### Compiling without cuDNN
The [cuDNN](https://developer.nvidia.com/cudnn) library is not mandatory, but required for full keypoint detection accuracy. In case your graphics card is not compatible with cuDNN, you can disable it by unchecking `USE_CUDNN` in CMake.
G
Gines 已提交
332

G
gineshidalgo99 已提交
333
Then, you would have to reduce the `--net_resolution` flag to fit the model into the GPU memory. You can try values like `640x320`, `320x240`, `320x160`, or `160x80` to see your GPU memory capabilities. After finding the maximum approximate resolution that your GPU can handle without throwing an out-of-memory error, adjust the `net_resolution` ratio to your image or video to be processed (see the `--net_resolution` explanation from [doc/demo_overview.md](./demo_overview.md)), or use `-1` (e.g., `--net_resolution -1x320`).
G
Gines 已提交
334 335


336

G
Gines 已提交
337
#### Custom Caffe (Ubuntu Only)
G
gineshidalgo99 已提交
338 339
Note that OpenPose uses a [custom fork of Caffe](https://github.com/CMU-Perceptual-Computing-Lab/caffe) (rather than the official Caffe master). Our custom fork is only updated if it works on our machines, but we try to keep it updated with the latest Caffe version. This version works on a newly formatted machine (Ubuntu 16.04 LTS) and in all our machines (CUDA 8 and 10 tested). The default GPU version is the master branch, which it is also compatible with CUDA 10 without changes (official Caffe version might require some changes for it). We also use the OpenCL and CPU tags if their CMake flags are selected.

G
Gines 已提交
340 341 342 343
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. Note that cuDNN is required in order to get the maximum possible accuracy in OpenPose.
<p align="center">
    <img src="media/cmake_installation/im_5.png", width="480">
</p>
G
Gines 已提交
344 345


346

G
Gines 已提交
347 348
#### Custom OpenCV (Ubuntu Only)
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.
349 350 351



G
Gines 已提交
352 353
#### Doxygen Documentation Autogeneration (Ubuntu Only)
You can generate the documentation by setting the `BUILD_DOCS` flag. The documentation will be generated in `doc/doxygen/html/index.html`. You can simply open it with double-click (your default browser should automatically display it).
354 355 356



G
Gines 已提交
357 358
#### CMake Command Line Configuration (Ubuntu Only)
Note that this step is unnecessary if you already used the CMake GUI alternative.
359

G
Gines 已提交
360 361 362 363 364 365
Create a `build` folder in the root OpenPose folder, where you will build the library --
```bash
cd openpose
mkdir build
cd build
```
366

G
Gines 已提交
367
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.
368

G
Gines 已提交
369 370 371 372 373
##### SCENARIO 1 -- Caffe not installed and OpenCV installed using `apt-get`
In the build directory, run the below command --
```bash
cmake ..
```
374

G
Gines 已提交
375
##### SCENARIO 2 -- Caffe installed and OpenCV build from source
B
Bikramjot Hanzra 已提交
376
In this example, we assume that Caffe and OpenCV are already present. The user needs to supply the paths of the libraries and the include directories to CMake. For OpenCV, specify the include directories and the libraries directory using `OpenCV_INCLUDE_DIRS` and `OpenCV_LIBS_DIR` variables respectively. Alternatively, the user can also specify the path to the `OpenCVConfig.cmake` file by setting the `OpenCV_CONFIG_FILE` variable. 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.
G
Gines 已提交
377
```bash
B
Bikramjot Hanzra 已提交
378 379 380 381 382 383 384 385
cmake -DOpenCV_INCLUDE_DIRS=/home/"${USER}"/softwares/opencv/build/install/include \
  -DOpenCV_LIBS_DIR=/home/"${USER}"/softwares/opencv/build/install/lib \
  -DCaffe_INCLUDE_DIRS=/home/"${USER}"/softwares/caffe/build/install/include \
  -DCaffe_LIBS=/home/"${USER}"/softwares/caffe/build/install/lib/libcaffe.so -DBUILD_CAFFE=OFF ..
```

```bash
cmake -DOpenCV_CONFIG_FILE=/home/"${USER}"/softwares/opencv/build/install/share/OpenCV/OpenCVConfig.cmake \
G
Gines 已提交
386 387 388
  -DCaffe_INCLUDE_DIRS=/home/"${USER}"/softwares/caffe/build/install/include \
  -DCaffe_LIBS=/home/"${USER}"/softwares/caffe/build/install/lib/libcaffe.so -DBUILD_CAFFE=OFF ..
```
389

G
Gines 已提交
390 391 392
##### SCENARIO 3 -- OpenCV already installed
If Caffe is not already present but OpenCV is, then use the below command.
```bash
B
Bikramjot Hanzra 已提交
393 394 395 396 397 398
cmake -DOpenCV_INCLUDE_DIRS=/home/"${USER}"/softwares/opencv/build/install/include \
  -DOpenCV_LIBS_DIR=/home/"${USER}"/softwares/opencv/build/install/lib ..
```

```bash
cmake -DOpenCV_CONFIG_FILE=/home/"${USER}"/softwares/opencv/build/install/share/OpenCV/OpenCVConfig.cmake ..
G
Gines 已提交
399
```