Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function request! #140

Open
guoshao99 opened this issue Jul 31, 2024 · 1 comment
Open

Function request! #140

guoshao99 opened this issue Jul 31, 2024 · 1 comment

Comments

@guoshao99
Copy link

Hello, can MarkersPlugin be used to drag and drop the marked plugin to change its position?

@ntanhfai
Copy link

ntanhfai commented Aug 15, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants