如何在python服务器上处理通过websocket通过javascript发送的blob?

如何在python服务器上处理通过websocket通过javascript发送的blob?,javascript,python,google-chrome,opencv,websocket,Javascript,Python,Google Chrome,Opencv,Websocket,我必须使用Opencv在python服务器上处理图像。这个blob会转到python服务器,但我不知道如何使用openCV将这个blob转换回image //this is my javascript function to send image converted to blob, //back to my python server function () { ctx.drawImage(video, 0, 0, 320, 240);

我必须使用Opencv在python服务器上处理图像。这个blob会转到python服务器,但我不知道如何使用openCV将这个blob转换回image

 //this is my javascript function to send image converted to blob, 
//back to my python server
         function () {

             ctx.drawImage(video, 0, 0, 320, 240);
            var data = canvas.get()[0].toDataURL('image/jpeg', 1.0);
             newblob = dataURItoBlob(data);
             ws.send(newblob);

            }
这是我的python后端处理

class EchoServerProtocol(WebSocketServerProtocol):

       def onMessage(self, msg, binary):
         img = # here the code to convert blob into the image
         blur = cv2.blur(img, (5, 5))
         hsv = cv2.cvtColor(blur, cv2.COLOR_BGR2HSV)
         msg = hsv
         print "the image:", msg
         #conver the image back to blob and reply back to the websocket
         #havent written the code for this part yet
         self.sendMessage(msg, binary)

请帮我弄清楚这一点

检查此blob是如何生成的,然后对其进行反向工程

检查此blob是如何生成的,然后对其进行反向工程

尝试查看开发人员工具中的“网络”选项卡,查看blob是如何通过websocket发送的。它可能是b64编码的,在此之后,使用imdecode从jpeg生成cv图像尝试查看开发工具中的“网络”选项卡,查看blob是如何通过websocket发送的。它可能是b64编码的,然后使用imdecode从jpeg生成cv图像