How to convert Rust Image to opencv?

How to convert Rust Image to opencv ?

pub fn facedetect(buf: Vec<u8>)->Result<bool>{
  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)?;

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

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

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.