whitphx/streamlit-webrtc

Show multiple images using one cam's callback

kevinlinxc opened this issue · 2 comments

When I receive the original frame in the callback, I want to do some simple processing on the image, for now let's just pretend I want to crop it. Then, I want to show the raw image and the cropped version in two different locations on the streamlit webapp (e.g. in two streamlit columns)

If I use two webrtc_streamer instances, I have to initialize the camera twice, which is not as elegant. Is there a way to get what I want?

Ok, I think this example might be what I'm looking for:
https://github.com/whitphx/streamlit-webrtc/blob/main/pages/5_fork_multi_outputs.py

The code looks a little bit complex though.

It wasn't too complex, but there was definitely around 20-30s of startup lag and the callbacks running in their own thread was kind of problematic for image tracking.