|
1 | | -# depthai-api |
| 1 | +# DepthAI Python Library |
2 | 2 |
|
3 | | -Host-side DepthAI source code |
| 3 | +Python bindings for C++ depthai-core library |
4 | 4 |
|
5 | | -## Content description |
| 5 | +## Documentation |
6 | 6 |
|
7 | | -- **host** - contains the code which runs on the host computer (Raspberry Pi or a PC that has a DepthAI device connected). This part has: |
| 7 | +Documentation is available over at [Luxonis DepthAI Python API](https://docs.luxonis.com/api/) |
8 | 8 |
|
9 | | - - **py_module** - python module (made only with C++ code with `pybind11`). Builds an `.so` libray that can be imported with python. |
10 | | - - **app** - C++ app for easier debugging and development. |
11 | | - - **core** - main functionality of the host, which is used in `py_module` and `app`. |
| 9 | +## Installation |
12 | 10 |
|
13 | | -- **shared** - code that is shared between host and DepthAI device. This code gets also into the firmware binary `depthai.cmd` |
14 | | - |
15 | | -## Tested platforms |
16 | | - |
17 | | -- Ubuntu 16.04, 18.04; |
18 | | -- Raspbian 10; |
19 | | -- macOS 10.14.6, 10.15.4; |
| 11 | +Prebuilt wheels are available in [Luxonis repository](https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/) |
| 12 | +Make sure pip is upgraded |
| 13 | +``` |
| 14 | +python3 -m pip install -U pip |
| 15 | +python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai |
| 16 | +``` |
| 17 | +## Building from source |
20 | 18 |
|
21 | | -## Setup |
| 19 | +### Dependencies |
| 20 | + - cmake >= 3.2 |
| 21 | + - C/C++11 compiler (clang, gcc, msvc, ...) |
| 22 | + - Python |
22 | 23 |
|
23 | | -- Install development environment dependencies: |
24 | | - - Linux: |
| 24 | +Along these, dependencies of depthai-core are also required |
| 25 | +See: [depthai-core dependencies](https://github.com/luxonis/depthai-core#dependencies) |
25 | 26 |
|
26 | | - sudo apt-get install -y git python-pip cmake cmake-gui libusb-1.0-0-dev |
27 | | - - macOS: |
28 | 27 |
|
29 | | - brew install coreutils python3 cmake libusb wget opencv |
| 28 | +### Building |
30 | 29 |
|
31 | | -- After cloning the repo, update the third-party libraries used: |
| 30 | +To build a shared library from source perform the following: |
| 31 | +``` |
| 32 | +mkdir build && cd build |
| 33 | +cmake .. |
| 34 | +cmake --build . --parallel |
| 35 | +``` |
32 | 36 |
|
33 | | - ./install_dependencies.sh |
| 37 | +To build a wheel, execute the following |
| 38 | +``` |
| 39 | +python3 -m pip wheel . -w wheelhouse |
| 40 | +``` |
34 | 41 |
|
35 | 42 |
|
36 | | -## Build and run |
| 43 | +## Tested platforms |
37 | 44 |
|
38 | | -- **Windows (x64)** |
39 | | -In seconds step, remove parameter *-A x64* for 32bit variant (Python must also be 32bit) |
40 | | -``` |
41 | | -mkdir -p build && cd build |
42 | | -cmake .. -A x64 -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_BINARY_DIR="C:/.hunter_bin" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="%CD%\..\cmake\ToolchainConfig.cmake" |
43 | | -cmake --build . --parallel |
44 | | -``` |
| 45 | +- Windows 10 |
| 46 | +- Ubuntu 16.04, 18.04; |
| 47 | +- Raspbian 10; |
| 48 | +- macOS 10.14.6, 10.15.4; |
45 | 49 |
|
46 | | -- **host/py_module** |
47 | | - |
48 | | - cd host/py_module |
49 | | - mkdir -p build |
50 | | - cd build |
51 | | - cmake .. |
52 | | - make -j |
53 | | - Alternatively, when this repo is used as a submodule in https://github.com/luxonis/depthai, the build process can be automated with the script below, that is also copying the generated `.so` back to `depthai`: |
54 | | - - `./build_py_module.sh` |
55 | | - first it does a full build, then at subsequent runs compiles only the modified source files. |
56 | | - - `./build_py_module.sh --clean` |
57 | | - cleans up the build folder and does a full rebuild. |
58 | | - |
59 | | - |
60 | | -- **host/app** |
61 | | - (Note: this is currently outdated and doesn't run properly) |
62 | | - `DEPTHAI_EXTRAS_PATH` in `main.cpp` may have to be adjusted first. |
63 | | - |
64 | | - cd host/app |
65 | | - mkdir -p build |
66 | | - cd build |
67 | | - cmake .. |
68 | | - make -j |
69 | | - ./depthai_app |
70 | | - |
71 | | - |
72 | 50 | ## Troubleshooting |
73 | 51 |
|
74 | 52 | 1. Build failure on Ubuntu 18.04 ("relocation ..." link error) with gcc 7.4.0 (default) - [**issue #3**](https://github.com/luxonis/depthai-api/issues/3) |
|
0 commit comments