I deployed a flask app to my cloud server on linode. I have nginx running static files and gunicorn running the python script. I've also set up a ufw When deployed I click the link which begins the open cv loop but it is unable to access the camera by index 0.
[ WARN:11] global /tmp/pip-req-build-24v3eisa/opencv/modules/videoio/src/cap_v4l.cpp (890) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
When running locally the script runs fine the first time but I need to restart the local server and launch again for it to work. Is there a way I can access the users camera on the server with permission from the user?
CodePudding user response:
I found a few answers to my original question about accessing users camera from the front end to the server. I am sure my many python friends who have asked this question will find it useful.
It seems if you want to use Flask you will need to use JS's getusermedia() to access the users camera with permision and stream it back as seen in this digital ocean article;
I also found another method using webrtc on the streamlit docs which seems easier. Only negative is I will have to rebuild the app to streamlit but it is very user friendly and wont be a problem! :)