Skip to main content

opencv-style image display that displays the image/stream on a local webserver instead of a screen.

Project description

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

  1. Clone the repository or download the code files.
  2. Install the required dependencies by running the following command:
    pip install opencv-python flask
    

Usage

  1. Import the necessary modules:

    import webViewer
    
  2. Create an instance of the VideoStream class:

    app = webViewer.VideoStream()
    
  3. Start the Flask web server on a specified port (default is 80):

    app.run()
    
  4. 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)
    
  5. 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.

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 templates folder relative to the script's location. You can specify custom template paths when creating a VideoStream instance:

    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 VideoStream instance:

    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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webstreamviewer-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webStreamViewer-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file webstreamviewer-1.0.0.tar.gz.

File metadata

  • Download URL: webstreamviewer-1.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for webstreamviewer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bdd446f8985013807634019ab890b5cef467afb1d8a520f3d63b9335cda02612
MD5 411eee37ebcf82fc9f8f7183230cda5e
BLAKE2b-256 63f8ca19e835aabdf62b52ca797c1c55230bf06db199b48e625b2caf16f1661e

See more details on using hashes here.

File details

Details for the file webStreamViewer-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for webStreamViewer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95085dbb8ac756671179b30a57b422c40cdcc385437a01597aac7945be9a634c
MD5 b8efc7b5c7ea71c14d2c97e14c8b7cee
BLAKE2b-256 3710edc6e38ca91a589e6daaedd240e77d1d1ea5791969b697dfe3f30bef6baa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page