Currently, this is mostly an example of how to get Rust's opencv
crate (which is
bindings to OpenCV) to link to Conan's OpenCV.
I use Conan to install the OpenCV and other system dependencies. Additionally, to create the Cargo build script which
performs linking, I parse the conanbuildinfo.txt
to tell the opencv
crate about link information. Shortcuts
via just
are available. Install instructions are available in that repo, but
the simplest way is to cargo install just
. I use alias j=just
.
j install # uses conan to install dependencies to the build directory
j apply # parses conanbuildinfo.txt and sets environments variable
# within the .cargo/config.toml env section
Two command line utilities within the manage_opencv
crate are used to apply the
Conan-generated OpenCV link targets to Cargo's environment:
get_conan_libs
parsesconanbuildinfo.txt
and outputs TOML-compatible lists to standard output.apply_to_env
reads such TOML-input and applies them to theenv
section of a project-specific Cargo configuration.
The provided justfile
glues this together.
With the OPENCV_*
environment variables now applied to .cargo/config.toml
, Cargo will now build
the opencv
crate using Conan's OpenCV version.
Read camera input, output in a window.
Do everything with the opencv
library.
Read camera input, do processing, show in a window.
Do everything with Rust-native libraries (imageproc
, image
, cv
).
Show in the Rust-native GUI egui
.
highgui is crappy and native Rust CV is super slow, so this is the "best of both worlds". egui for GUI and OpenCV for image processing.