Just wondering if there was something alternative to opencv that has even got match_template
capabilities. I know there is Rust-cv but that is no longer maintained. So yeah just wondering?
I don't know of anything at the moment.
Out of curiosity, what don't you like about the opencv
crate? We use it at my work, and find it excellent.
I was juct curious if there was something that is in pure rust?
Do you know any good documentation for it, its easy to use but like it doesn't match python or C++ ways of doing things?
TBH, I find it does match the C++ way of doing things, which is kinda annoying Like, when you call a function that creates a new Mat
(e.g., resize()), you have to create a Mat
and pass it in as a &mut
parameter.
One tip I've found: use the ndarray
crate as much as possible. I pass all my images around as ndarray::Array2/3
instances, and only convert to Mat
when necessary. You can do a safe, zero-copy conversion from Array3
to Mat
, as described here:
https://old.reddit.com/r/rust/comments/16oa82b/rust_and_data_processing/kt7dvlu/
I am actually new to opencv so what is ndarray do exactly?
ndarray
has array types that are equivalent to opencv
's Mat
type. They're all arrays with a certain number of dimensions, and a certain data type - e.g., 2 dimensions, 640 x 480, 8-bit integer data type.
With Mat
, though, there is only one type: Mat
. It has methods that can tell you its dimensions and data type, which is fine, but it's easy to get them mixed up - to accidentally pass a Mat
that has 2 dimensions, and data type f32
, to a function that expects a 3D Mat
of data type u8
, for example.
With ndarray
's family of Array types, the number of dimensions and the data type are part of the type signature: Array3<u8>
is obviously a 3-dimensional array with a data type of u8
.
Additionally, ndarray
has a bunch of functionality that matches what numpy
offers.
So IMO, the best way to work the N-dimensional arrays is to use ndarray
most of the time, and convert to Mat
when you need to call an opencv
function.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.