Skip to content

Commit a3222df

Browse files
committed
feat: update license and readme
1 parent 1e8f280 commit a3222df

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

.gitmodules

Whitespace-only changes.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2016, 2017, 2018, 2019, 2020, 2021 Erwan BERNARD
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Readme.md

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
# pybind11_opencv_numpy
22

3-
An example of pybind11 for cv::Mat <-> np.array
3+
Binding between cv::Mat and np.array. And a small code example of how it work. the code work for `OpenCV 2.4`, `OpenCV 3+` and `OpenCV 4+`
4+
5+
The code in this repository create a simple binding, function in c++ are implemented in `example.cpp` file and the script that use them is `test.py`.
46

57
```bash
68
/project folder
79
├── build
810
├── example
9-
│ ├── exemple.so # generate with make
10-
│ └── example.cpython-36m-x86_64-linux-gnu.so # generate with setup.py
11+
│ ├── exemple.so # generate with cmake
12+
│ └── example.cpython-36m-x86_64-linux-gnu.so # generate with setup.py (the name will depends of the python version use)
1113
├── CMakeLists.txt
1214
├── setup.py
15+
├── ndarray_converter.cpp # Effective implementation of the binding
16+
├── ndarray_converter.h # Header for binding functions
1317
└── ...
1418
```
1519

16-
## Generation with make
20+
## Generation with cmake/make
21+
22+
*Note* : This method support opencv 2.4, opencv 3 and opencv 4.
1723

1824
We use [vcpkg](https://github.com/Microsoft/vcpkg) to install [pybind11](https://github.com/pybind/pybind11) library
1925

20-
*Note* : This method support opencv 2.4, opencv 3 and opencv 4.
2126

2227
```
2328
./vcpkg install pybind11
@@ -36,11 +41,6 @@ make
3641
make install
3742
```
3843

39-
### Run
40-
```bash
41-
python3 test.py
42-
```
43-
4444
## Generation with setup.py
4545

4646

@@ -52,15 +52,15 @@ pip3 install pybind11
5252

5353
### Compile
5454

55-
#### Opencv2.4+, Opencv3+
55+
#### OpenCV 2.4+, OpenCV 3+
5656

5757
```
5858
python3 setup.py build
5959
```
6060

61-
#### Opencv4
61+
#### OpenCV 4
6262

63-
In Opencv4, there a extra folder level for header (ex: `opencv4/opencv2/core/core.hpp`). To be able to compile with `setup.py` we need a extra command to indicate header location.
63+
In OpenCV 4, there a extra folder level for headers (ex: `opencv4/opencv2/core/core.hpp`). To be able to compile with `setup.py` we need a extra command to indicate header location.
6464

6565
```
6666
python3 setup.py build_ext --include-dirs "/usr/local/include/opencv4"
@@ -78,9 +78,3 @@ or
7878
```
7979
mv build/lib.linux-x86_64-3.5/example/example.cpython-36m-x86_64-linux-gnu.so example/example.cpython-36m-x86_64-linux-gnu.so
8080
```
81-
82-
### Run
83-
84-
```
85-
python3 test.py
86-
```

0 commit comments

Comments
 (0)