I am trying to use the opencv crate with the dnn module. I have compiled opencv with DNN and verified that all the shared libraries exist. If I try to build the following code
use opencv::{
dnn,
core::{Vector},
};
fn main() {
let a: Vector<i32> = Vector::<i32>::new();
println!("OPENCV TEST");
}
I receive the error
error[E0432]: unresolved import `opencv::dnn`
--> src/main.rs:2:5
|
2 | dnn,
| ^^^ no `dnn` in the root
For more information about this error, try `rustc --explain E0432`.
My Cargo.toml
[package]
name = "foobar"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
opencv = "0.80.0"
At first I thought this issue was somehow related to rust not being able to find some shared library (e.g. libcudnn.so), but (a) that should be a runtime concern, and (b) this error seems to be suggesting that the module itself is not found. I'm a bit unclear on what is going on here, and I think I'm doing something foolish.
I have:
- confirmed opencv was built with dnn and that all the libraries exist
- the linker path contains the relevant library paths (which still should just be a runtime concern)
- the crate does not specify the need to gate the "dnn" module with a feature flag
- Cargo.toml specifies rust 2021
If anyone can suggest some debugging tips, that would be helpful. Thanks.