Using camera_input to save a picture every minute (time lapse mode)

Hi,
I just learned about the camera_input widget and looks great! thanks.
I would like to have a streamlit app that allows to set a time interval like 1 minute, and a number of images, like 100, and when started will enter a loop:

  • take an image from the webcam
  • store it somewhere
  • wait a minute
  • take another image …

I see that is easy to take the returned object from the camera input and save it somewhere:

picture = st.camera_input("First, take a picture...")

if picture:
    with open ('test.jpg','wb') as file:
          file.write(picture.getbuffer())

Is it possible to repeat the image acquisition without the need of a click from the user? I could not see a clear way to trigger the acquisition from the python side.

thanks
Marco

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.