Summary
Share a clear and concise description of the issue. Aim for 2-3 sentences.
original post:
Not sure where the captured camera image is stored locally or cached? Can I extract the image from a file path?
Steps to reproduce
Code snippet:
def main():
"""A simple ID wine"""
#Title of the app
st.title("wine BAKER app with streamlit + Camera Preview")
st.subheader("streamlit is :fire:")
img_file_buffer = st.camera_input("一二三,🍆 ")
if img_file_buffer is not None:
# To read image file buffer with OpenCV:
bytes_data = img_file_buffer.getvalue()
cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
# Check the type of cv2_img:
# Should output: <class 'numpy.ndarray'>
st.write(type(cv2_img))
# Check the shape of cv2_img:
# Should output shape: (height, width, channels)
st.write(cv2_img.shape)
#st.image('cv2_img')
#how to save captured camera input image
"""with open(cv2_img.name, "wb") as f:
f.write(cv2_img.getbuffer())
st.success("File Saved")"""
image = Image.open('cv2_img')
st.image(image, caption='Cheese', use_column_width=False)
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
Explain what you expect to happen when you run the code above.
Actual behavior:
Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.
Debug info
- Streamlit version: (get it with
$ streamlit version
) - Python version: (get it with
$ python --version
) - Using Conda? PipEnv? PyEnv? Pex?
- OS version:
- Browser version:
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
- Link to your GitHub repo:
- Link to your deployed app:
Additional information
If needed, add any other context about the problem here.