ugu11 / camera_tutorial

Apache License 2.0
36 stars 11 forks source link

Live streaming #5

Open johnbird7 opened 4 years ago

johnbird7 commented 4 years ago

Hey Hugand. Love your work. So I've been trying to send live frames to server after converting to base64. But the conversion from yuv to normal image for every image captured takes a lot of time. Is it possible to make it real-time? I just want to send every frame to the server and I can't convert yuv or bgra directly to base64 . Please help.

ugu11 commented 3 years ago

Converting the image from YUV to RGBA on the server should be faster, so I believe you can convert the _savedImage.planes list to base64, send that over to the server, and if you need you can convert it to RGBA. I haven't converted an image to base64 with dart/flutter before, but I believe you can find a solution to here: https://stackoverflow.com/questions/50036393/how-to-convert-an-image-to-base64-image-in-flutter

johnbird7 commented 3 years ago

Thank you for the quick response. I am able to send the _savedImage.planes list to redis and on server I'm reading the same. I work with python and opencv for image processing. Is there a way to convert these to save jpg/png on disk? I haven't worked with yuv420 and bgra8888 .. If python/C is easy for you, could you please share a function that takes planes as args and return the imagepath saved on disk?

ugu11 commented 3 years ago

I've never used python with C, but I'm pretty sure there is an easier way to do the yuv to rgba conversion with python and opencv. I did a quick search and I came across this: https://stackoverflow.com/questions/60729170/python-opencv-converting-planar-yuv-420-image-to-rgb-yuv-array-format https://gist.github.com/Quasimondo/c3590226c924a06b276d606f4f189639 https://www.programmersought.com/article/7067280860/

I hope this helps :)