You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would you go about cropping a Mat from a Rect?
The simplest way I can think of currently is by creating a whole new Mat and moving it back over (I haven't actually tested this and could be completely misunderstanding what assign_to_def() does):
let region: Rect = get_regeion_from_somewhere();
let mut target_mat: Mat = get_mat_from_somewhere();
let mut cropped: Mat = Mat::default();
target_mat.roi(region).unwrap().assign_to_def(&mut cropped).unwrap();
target_mat = cropped;
But that feels like too much work for something this simple.
Am I missing something really obvious?
Thanks for any help.
The text was updated successfully, but these errors were encountered:
How would you go about cropping a Mat from a Rect?
The simplest way I can think of currently is by creating a whole new Mat and moving it back over (I haven't actually tested this and could be completely misunderstanding what
assign_to_def()
does):But that feels like too much work for something this simple.
Am I missing something really obvious?
Thanks for any help.
The text was updated successfully, but these errors were encountered: