Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
How to pass a video return from JavaScript to python backend in Django view for OpenCV

I want to do certain tasks and the processes are as follows: 1. Access the camera of the user to get the video-frames from them. 2. Process the video frames from the backend code for facial recognition and some more tasks. 3. Return the processed frame back to the user.

Initially, I had used cv2.VideoCapture(0) and it was simply triggering the camera of the system which was hosting the server, i.e. my personal laptop. So, I used JavaScript to trigger the camera of the user's system. The HTML and JS code is as follows:

<div id="container">
    <video autoplay="true" id="videoElement">
    
    </video>
</div>
<script>
    var video = document.querySelector("#videoElement");

if (navigator.mediaDevices.getUserMedia) {
  navigator.mediaDevices.getUserMedia({ video: true })
    .then(function (stream) {
      video.srcObject = stream;
    })
    .catch(function (err0r) {
      console.log("Something went wrong!");
    });
}
</script>

Now I want to get the video feed from the user and link it to the backend to process the video frames.

My views.py :

class VideoCamera():
    def __init__(self):
        self.video = cv.VideoCapture(0)
        success, frame = self.video.read()
        ...
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda