mobimeo / node-yolo

Node bindings for YOLO/Darknet image recognition library
https://lab.moovel.com/blog/what-you-get-is-what-you-see-nodejs-yolo
MIT License
372 stars 51 forks source link

Decode data client side #24

Open xseignard opened 7 years ago

xseignard commented 7 years ago

Hello again,

I'd like to send the modified image frame via websockets to a client.

For now all what I get is a green image on the client side, I assume I do something wrong, any idea on how to decode the frame client side? or server side to then send it as a jpeg base64.

See my code here: https://github.com/xseignard/yolo9000-test/blob/9e4f1723c98912fd92683902bf8b67f44025a492/src/public/main.js#L14-L26

Best regards

OrKoN commented 7 years ago

Hi @xseignard so far I have decoded with ffmpeg only https://github.com/moovel/node-yolo/blob/master/test/darknetImageTest.js#L12

It requires the pix_fmt set which basically defines the order of colors. For me, bgr24 is working but I have also experienced that different opencv versions have different default pixel format.

OrKoN commented 7 years ago

Please note that the image recognition won't work concurrently so you will need to make sure only one image is recognized at a time.

xseignard commented 7 years ago

Yes, it works server side for me too, and sending the image encoded as base 64 through websocket also works. But I'm pretty sure the decoding of the raw rgb24 data can be achieved client side, it will eliminate the burden of using ffmpeg on the server side. I haven't found a solution so far. I'll investigate it further.

OrKoN commented 7 years ago

Hi @xseignard have you found a solution?