huggingface / huggingface/candle

Demo showing how to load in candle computer vision model using webcam

Open
#1,240 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
21k
Forks
1.8k
Avg merge
16h 42m
Merged PRs (30d)
25

Description

```
use anyhow::Result; // Automatically handle the error types
use opencv::{
prelude::*,
videoio,
highgui
}; // Note, the namespace of OpenCV is changed (to better or worse). It is no longer one enormous.
fn main() -> Result<()> { // Note, this is anyhow::Result
// Open a GUI window
highgui::named_window("window", highgui::WINDOW_FULLSCREEN)?;
// Open the web-camera (assuming you have one)
let mut cam = videoio::VideoCapture::new(0, videoio::CAP_ANY)?;
let mut frame = Mat::default(); // This array will store the web-cam data
// Read the camera
// and display in the window
loop {
cam.read(&mut frame)?;
highgui::imshow("window", &frame)?;
let key = highgui::wait_key(1)?;
if key == 113 { // quit with q
break;
}
}
Ok(())

}

```

Here is a basic example of opening Qt using Opencv-rust.
It would be great to have a working example using this alongside candle!
Open to submitting this as a pr in any of the example folders.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing example folders and the provided opencv-rust webcam snippet. Determine how a Candle computer vision model should be loaded alongside webcam capture and display. Done means a working example in an example folder that combines Candle with OpenCV webcam input.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, rust
Domain
computer-vision
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.