Open guoshao99 opened 3 months ago
Hi dev team, I want to display src from flask src: Normally, a flask video feed will be like this:
To establish the flask/opencv connection you do something like the following. In your flask you setup a function:
def webcam():
camera = cv2.VideoCapture(0)
while True:
success, frame = camera.read()
if success:
ret, buffer = cv2.imencode('.jpg', frame)
frame = buffer.tobytes()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
else:
camera.release()
And you setup an API endpoint
@app.route('/webcam')
def webcam_display():
return Response(webcam(), mimetype='multipart/x-mixed-replace;
boundary=frame')
And in your frontend to display the stream, you just call the api endpoint in the image source.
<img src={url} alt="webcam" />
If there are multiple cameras you could maybe set up multiple endpoints and then via frontend connect to whatever endpoint you need via state at the time.
Then, how do I feed this kind of src?
Hello, can MarkersPlugin be used to drag and drop the marked plugin to change its position?