Giter Club home page Giter Club logo

df's Introduction

import cv2 from flask import Flask, render_template, Response

video = cv2.VideoCapture(0) app = Flask(name)

def video_stream(): while True: ret, frame = video.read() if not ret: break else: ret, buffer = cv2.imencode('.jpeg', frame) frame = buffer.tobytes() yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')

@app.route('/camera') def camera(): return render_template('camera.html')

@app.route('/video_feed') def video_feed(): return Response(video_stream(), mimetype='multipart/x-mixed-replace; boundary=frame')

@app.route('/') def index(): return 'Hello, world!'

if name == 'main': app.run(host='0.0.0.0', port=5000, debug=False)

Release the VideoCapture object when the application stops

@app.teardown_appcontext def cleanup(exception): video.release()

df's People

Contributors

obada-yahya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.