Skip to content

Instantly share code, notes, and snippets.

@rajeshpachaikani
Created November 14, 2021 11:14
Show Gist options
  • Save rajeshpachaikani/949652fe9fac4b246d68fd3f301019df to your computer and use it in GitHub Desktop.
Save rajeshpachaikani/949652fe9fac4b246d68fd3f301019df to your computer and use it in GitHub Desktop.
Rust opencv demo
/*
Author: Rajesh Pachaikani
Contact: rajesh@makeitnow.in
*/
use opencv::{highgui, prelude::*, videoio, Result};
fn main() -> Result<()> {
let mut cam = videoio::VideoCapture::new(0, videoio::CAP_ANY)?;
highgui::named_window("window", highgui::WINDOW_FULLSCREEN)?;
let mut frame = Mat::default();
loop{
cam.read(&mut frame)?;
highgui::imshow("window", &frame)?;
let key = highgui::wait_key(1)?;
if key == 113{
break;
}
}
Ok(())
}
@MuneebHoda
Copy link

failed to run custom build command for opencv v0.78.0
-- Error while running this code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment