Reputation: 317
I am trying Rust (ver 1.4.0) these days, and coding with opencv-rust library.
I wrote some code like this.
extern crate opencv;
use self::opencv::highgui;
use self::opencv::core::Mat;
fn main() {
load("image/test4.jpg");
}
fn load(path: &str) {
let src: Mat = highgui::imread(path, 1).unwrap();
if src.empty().unwrap() {
println!("Img load error");
}
else {
println!("Img load success");
}
}
When I run cargo run
it shows Img load error
.
However, when I added a println!
at first line in load
function like
fn load(path: &str) {
println!("whatever");
let src: Mat = highgui::imread(path, 1).unwrap();
if src.empty().unwrap() {
println!("Img load error");
}
else {
println!("Img load success");
}
}
It shows Img load success
.
But when I change it to other code like let a: i32 = 1;
, it shows Img load error
again.
I have no idea what's going on.
System info:
Upvotes: 1
Views: 985
Reputation: 430554
This bug was reported and fixed. Version 0.2.2 should now work.
Upvotes: 1