A very simple example to run Python's OpenCV in the backend and interact with the user with javascrit in the frontend.
This example steps:
-
It displays a video file loaded with opencv in the web page streaming it as a jpg sequence
-
The video stops at frame 10
-
You can make a rectangle selection at the frame (with Javascript)
-
When you click send (or refresh the page) the rectangle attributes are send to python with http GET
*Suggestion: Use pyenv + pipenv to manage python and libs versions
Install dependencies
pipenv install
Enable Virtual Enviroment
pipenv shell
Run Flask
python3 -m flask run
Build image
docker build -t opencvweb .
Run container
docker run -it --name opencvweb -p 5000:5000 opencvweb