Genie Discord forum

Author AvatarMonty Hall
3/26/2023, 1:28:48 AM

I do a fair amount of open CV stuff. I have an RGB matrix that I'd like to pump to the web browser (let say at 10hz). How can I accomplish this?

Author AvatarMonty Hall
3/27/2023, 1:31:05 AM

Looks like this is how it's done in python flask

Author AvatarMonty Hall
3/27/2023, 1:31:15 AM
#!/usr/bin/env python
from flask import Flask, render_template, Response
from camera import Camera

app = Flask(__name__)

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

def gen(camera):
    while True:
        frame = camera.get_frame()
        yield (b'--frame\r\n'
               b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')

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

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
Author AvatarMonty Hall
3/27/2023, 1:31:37 AM
<html>
  <head>
    <title>Video Streaming Demonstration</title>
  </head>
  <body>
    <h1>Video Streaming Demonstration</h1>
    <img src="{{ url_for('video_feed') }}">
  </body>
</html>
Author AvatarMonty Hall
3/27/2023, 1:31:55 AM

Just have to figure out how to do this in genie.

Author AvatarPere
3/27/2023, 9:16:35 PM

We are discussing the same thing here https://discord.com/channels/774897545717219328/1088584153701814362

I'll update this thread once I get the code working