README for Web Viewer
Introduction
The WebVideoViewer is a Python application that allows you to create subpages with live video streams from a webcam or other source. It uses the Flask framework to handle web requests and displays video frames in real-time.
Requirements
- Python 3.x
- OpenCV (cv2) library
- Flask library
Installation
- Clone the repository or download the code files.
- Install the required dependencies by running the following command:
pip install opencv-python flask
Usage
-
Import the necessary modules:
import webViewer
-
Create an instance of the
VideoStreamclass:app = webViewer.VideoStream()
-
Start the Flask web server on a specified port (default is 80):
app.run()
-
Continuously capture frames from the webcam and update subpages:
cap = cv2.VideoCapture(0) while True: _, frame = cap.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) app.imshow("frame", frame) app.imshow("gray", gray)
-
Access the subpages:
- The home page lists all the available subpages. Visit the root URL (e.g.,
http://localhost:80/) to see the home page. - Each subpage displays a live video stream. Add the subpage name to the root URL (e.g.,
http://localhost:80/video1) to access a specific subpage.
- The home page lists all the available subpages. Visit the root URL (e.g.,
Customization
You can customize the following aspects of the Flask Subpage App:
-
Templates: The app uses HTML templates to render the home page and subpages. By default, it looks for the templates in the
templatesfolder relative to the script's location. You can specify custom template paths when creating aVideoStreaminstance:app = VideoStream(homePageTemplate="path/to/home.html", subpageTemplate="path/to/subpage.html")
-
Port: The default port for the Flask web server is 80. If you want to use a different port, specify it when creating a
VideoStreaminstance:app = VideoStream(port=5000)
License
This project is licensed under the MIT License. Feel free to modify and use it according to your needs.
Acknowledgments
This application was inspired by the Flask video streaming tutorial from the Official Flask Documentation
- OpenCV - Open Source Computer Vision Library: https://opencv.org/
- Flask - A micro web framework written in Python: https://flask.palletsprojects.com/
Metadata
Release files for webStreamViewer 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| webstreamviewer-1.0.0.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| webStreamViewer-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / webstreamviewer-1.0.0.tar.gz
| Download URL | webstreamviewer-1.0.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdd446f8985013807634019ab890b5cef467afb1d8a520f3d63b9335cda02612
|
|
BLAKE2b-256 checksum How to use checksums |
63f8ca19e835aabdf62b52ca797c1c55230bf06db199b48e625b2caf16f1661e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / webStreamViewer-1.0.0-py3-none-any.whl
| Download URL | webStreamViewer-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95085dbb8ac756671179b30a57b422c40cdcc385437a01597aac7945be9a634c
|
|
BLAKE2b-256 checksum How to use checksums |
3710edc6e38ca91a589e6daaedd240e77d1d1ea5791969b697dfe3f30bef6baa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|