How to convert Rust Image to opencv?

How to convert Rust Image to opencv ?

facedetect.rs:

pub fn facedetect(buf: Vec<u8>)->Result<bool>{
  // TEST FACE DETECT
  let xml = "/usr/share/opencv4/haarcascades/haarcascade_frontalface_default.xml";
  let mut face_detector = objdetect::CascadeClassifier::new(xml)?;
  //let img = imgcodecs::imread(path, -1).unwrap(); // Issue over here
  let img = imgcodecs::imdecode(&types::VectorOfu8 :: from_iter(buf), imgcodecs::IMREAD_COLOR)?;

main.rs:

  let mut img = image::open(path).unwrap();
  facedetect::facedetect(img.to_rgb8().to_vec());

This way not working. Code works with path to filesystem (imgcodecs::imread), my goal is to read image from memory

Code works, no help needed