how to convert a rgbaImage to opencv's Mat? #2307
Replies: 2 comments 1 reply
-
after some research i find a way to do it . |
Beta Was this translation helpful? Give feedback.
-
First of all, big thank you @ProgramAPE and @HeroicKatora, spent almost an hour on trying to convert image into Note: I'm using // Converts rawImage into opencv::Mat
fn into_mat(image: &RgbaImage) -> Mat {
unsafe {
Mat::new_rows_cols_with_data_unsafe_def(
image.height() as i32,
image.width() as i32,
core::CV_8UC4,
image.as_raw().clone().as_mut_ptr() as *mut _,
)
.unwrap()
}
} |
Beta Was this translation helpful? Give feedback.
-
I want to use the image to take screencapture and then send the pic to opencv to analysis.
and the opencv use Mat data type. so i want to turn the image to Mat.
Did anyone can help me? ths!
Beta Was this translation helpful? Give feedback.
All reactions