Skip to content

How do I efficiently display OpenCV webcam stream #4541

Answered by YgorSouza
braedenArcVoxel asked this question in Q&A
Discussion options

You must be logged in to vote

I don't know about calling the backend directly, you may want to look at discussions like #1641 #3457 #1606 for ideas.

But for what it's worth, enabling optimizations in the debug build makes a huge difference. On my test it made the time to generate the texture go from 140ms to about 5ms for a 2520x1920 image (disclaimer: my camera is 640x480, so I had OpenCV interpolate the image to test, and I have an i7-1260P).

Here is my entire test code for reference:

Details

[package]
name = "opencv-egui"
version = "0.1.0"
edition = "2021"

[dependencies]
eframe = "0.27.0"
opencv = "0.91.0"

[profile.dev]
opt-level = 1
use std::time::Instant;

use eframe::{
    egui::{self, DragValue, Ui},
    App,
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@qzd1989
Comment options

Answer selected by braedenArcVoxel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants