[英]Sending webcam.js data to python server
I am working on a face detection project that will open client webcam and detect faces in the frame. 我正在开发一个面部检测项目,该项目将打开客户端网络摄像头并检测框架中的面部。 For the detection part I am using opencv with python.
对于检测部分,我将opencv与python结合使用。 For opening the webcam in the client system I am using webcam.js.
为了在客户端系统中打开网络摄像头,我使用的是webcam.js。
How do I send this data to the python server? 如何将此数据发送到python服务器? Before using webcam.js I tried webRTC written in javascript.
在使用webcam.js之前,我尝试过使用javascript编写的webRTC。 But I was facing the same problem of sending the data over to python for the face detection part.
但是我面临着将数据发送到python进行面部检测的相同问题。
I want to do the face detection in python because I plan on adding more functionality to the application and it will be easier to code this with python. 我想在python中进行人脸检测,因为我计划在应用程序中添加更多功能,并且使用python编写代码会更加容易。
This is my code so far 到目前为止,这是我的代码
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<!-- <h3>THIS IS THE HOMEPAGE OF FASHIONCAST</h3> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcamjs/1.0.25/webcam.js"></script>
<div id="my_camera" style="width:320px; height:240px;"></div>
<script language="JavaScript">
Webcam.attach('#my_camera');
</script>
</body>
</html>
Can I use websockets to send this data to python. 我可以使用websockets将此数据发送到python吗? If webcam.js is not the right way to accomplish this, how to solve my problem with webrtc.
如果webcam.js不是实现此目的的正确方法,那么如何使用webrtc解决我的问题。 I could not find any links that talks about sending data from javascript to python.
我找不到任何有关将数据从javascript发送到python的链接。
One way to solve this problem with webrtc is to use RTCP to form a connection between the client and the server (the server behaves as the other peer). 用webrtc解决此问题的一种方法是使用RTCP在客户端和服务器之间建立连接(服务器充当另一个对等方)。 But i could find any resources to write the server part with python.
但是我可以找到任何资源来用python编写服务器部分。 aiortc does not support windows 10 platform and I am stuck here.
aiortc不支持Windows 10平台,我被困在这里。
Thanks in advance 提前致谢
The easiest way to accomplish this is to draw the video to a canvas and then send the data over websockets. 实现此目的的最简单方法是将视频绘制到画布上,然后通过websocket发送数据。 https://webrtchacks.com/webrtc-cv-tensorflow/ shows a complete example.
https://webrtchacks.com/webrtc-cv-tensorflow/显示了完整的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.