I am implementing a backend in Rust to run ONNX inferences on images using the opencv crate. Everything's working great but I have some doubts about a function I have written to crop an image at a specified location:
// assume coordinates are always valid
img
.col_range(&opencv::core::Range::new(xmin, xmax).unwrap()).unwrap()
.row_range(&opencv::core::Range::new(ymin, ymax).unwrap()).unwrap();
Is this the only way to accomplish a simple Mat crop? Hope I am not missing a better and more efficient solution.