@@ -8,8 +8,8 @@ Experimental Rust bindings for OpenCV 3 and 4.
8
8
9
9
The API is usable, but unstable and not very battle-tested; use at your own risk.
10
10
11
- [ Changelog] ( https://github.com/twistedfall/opencv-rust/blob/master/CHANGES.md )
12
- [ Troubleshooting] ( https://github.com/twistedfall/opencv-rust/blob/master/TROUBLESHOOTING.md )
11
+ [ Changelog] ( https://github.com/twistedfall/opencv-rust/blob/master/CHANGES.md ) |
12
+ [ Troubleshooting] ( https://github.com/twistedfall/opencv-rust/blob/master/TROUBLESHOOTING.md ) |
13
13
[ Support the project] ( https://github.com/sponsors/twistedfall )
14
14
15
15
## Quickstart
@@ -18,11 +18,13 @@ Make sure the supported OpenCV version (3.4 or 4.x) and Clang (part of LLVM, nee
18
18
generation) are installed in your system.
19
19
20
20
Update your Cargo.toml
21
+
21
22
``` toml
22
23
opencv = " 0.91.2"
23
24
```
24
25
25
26
Import prelude
27
+
26
28
``` rust
27
29
use opencv :: prelude :: * ;
28
30
```
@@ -124,12 +126,13 @@ The following variables affect the building the of the `opencv` crate, but belon
124
126
* ` PATH `
125
127
Windows searches for ` *.dll ` s in ` PATH ` among other places, be sure to set it up, or copy required OpenCV
126
128
` *.dll ` s next to your binary. Be sure to specify paths in UNIX style (/C/Program Files/Dir) because colon
127
- in ` PATH ` might be interpreted as the entry separator. Summary [ here] ( https://stackoverflow.com/a/6546427 ) .
129
+ in ` PATH ` might be interpreted as the entry separator. Summary [ here] ( https://stackoverflow.com/a/6546427 ) .
128
130
129
131
* clang crate environment variables
130
132
See crate's [ README] ( https://github.com/KyleMayes/clang-sys/blob/master/README.md#environment-variables )
131
133
132
134
## Cargo features
135
+
133
136
* There is a feature named after each OpenCV module (e.g. ` imgproc ` , ` highgui ` , etc.). They are all enabled by
134
137
default, but if a corresponding module is not found then it will silently be ignored. If you need to select a
135
138
specific set of modules be sure to disable the default features and provide the required feature set:
@@ -147,6 +150,7 @@ as well.
147
150
### OpenCV version support
148
151
149
152
The following OpenCV versions are supported at the moment:
153
+
150
154
* 3.4
151
155
* 4.x
152
156
@@ -183,14 +187,17 @@ or functions that are marked CV_NOEXCEPT in the OpenCV headers are infallible an
183
187
184
188
` CV_MAKETYPE ` and related ` CV_MAT_DEPTH ` constant functions are available to replace the corresponding OpenCV macros.
185
189
Yet it's usually easier to call ` ::opencv_type() ` function on the corresponding Rust type. E.g.:
190
+
186
191
``` rust
187
192
let t = u16 :: opencv_type (); // equivalent to CV_MAKETYPE(CV_16U, 1)
188
193
let t = Vec2f :: opencv_type (); // equivalent to CV_MAKETYPE(CV_32F, 2)
189
194
```
190
195
191
196
### C++ operators
197
+
192
198
Some C++ operators are supported, they are converted to the corresponding functions on Rust side. Here is the
193
199
list with the corresponding function name:
200
+
194
201
* ` [] ` → ` get() ` or ` get_mut() `
195
202
* ` + ` , ` - ` → ` add() ` , ` sub() `
196
203
* ` * ` , ` / ` → ` mul() ` , ` div() `
@@ -257,6 +264,7 @@ values, but they are reported in the API documentation.
257
264
Overloaded methods have been mostly manually given different names or automatically renamed to * _ 1, * _ 2, etc.
258
265
259
266
## Older OpenCV branches support
267
+
260
268
### OpenCV 2
261
269
262
270
If you can't use OpenCV 3.x or higher, the (no longer maintained) ` 0.2.4 ` version of this crate is known to
0 commit comments