2

this is my opencv code, how to convert padded_f32 mat object to tensorflow Tensor ?

let image = imgcodecs::imread("image_2021_08_02T09_11_01_447Z.png", imgcodecs::IMREAD_GRAYSCALE).unwrap();

let mut resized_image = Mat::default();
imgproc::resize(&image, &mut resized_image, Size::new(320, 320), 3., 3., 0);

let mut rgb_image = Mat::default();
imgproc::cvt_color(&resized_image, &mut rgb_image, imgproc::COLOR_BGR2RGB, 0)?;

let mut padded_f32 = Mat::default();
rgb_image.convert_to(&mut padded_f32, f32::typ(), 1., 0.)?;

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.