How to show pictures in "one place"?

Hello.
Have a problem, with st.image. Look on screenshot pls.


I whant that all frames will be in one place.
code:

f = st.file_uploader("Upload file")
if f is not None:
    pass
else:
    cap = cv.VideoCapture('small.mp4')
    if (cap.isOpened() == False):
        st.write("Error opening video stream or file")
    while (cap.isOpened()):
        success, frame = cap.read()
        if success:
            to_show = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
            st.image(to_show, caption='Video')
        else:
            break
    cap.release()

Help please.

Hi @iGero,

I think you can use st.empty()

Just modified your code a little bit, This is a sample to show your webcam feed,

import cv2
import streamlit as st

image_placeholder = st.empty()

cap = cv2.VideoCapture(0)
if (cap.isOpened() == False):
    st.write("Error opening video stream or file")

while (cap.isOpened()):
    success, frame = cap.read()
    if success:
        to_show = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        image_placeholder.image(to_show, caption='Video')
    else:
        break
cap.release()

Hope it helps !

1 Like

I have Video. And I Want to show Frame 2 times. How can I show in 2 column. st.beta_coloumn didn’t work.

When the next frame came, it showed on a new position, not on a fixed position