1

i have to process the image back at the python server with Opencv . the blob goes to the python server but i could not figure out how to convert this blob back into image with openCV

 //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);

            }

this is my python backend handling

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)

please help me figure this out

2
  • Try looking at the network tab in your developer tools to see how a blob is sent through a websocket. Commented Oct 9, 2013 at 15:03
  • it's probably b64 encoded, after that use imdecode to make a cv image from the jpeg Commented Oct 9, 2013 at 16:08

1 Answer 1

1

Check out how this blob is getting made and then reverse engineer it

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.