https://kotlinlang.org logo
#ktor
Title
# ktor
a

Ananiya

08/17/2022, 12:37 PM
any way to send
BufferedImage
over websocket efficiently 1 tried to deserilize the constructor using GSON because it has nested object resulting the https://stackoverflow.com/questions/43301580/gson-cant-serialize-bufferedimages 2 tried kotlinx serilization , doesn't work since
BufferedImage
has no
@Serilizable
annotation 3 tried converting buffered image -> float array -> to string(using joinToString) kind of worked but its super slow and unresponsive 4 tried converting buffered image -> bytearray using
ByteArrayOutputStream
and
ImageIO.write()
has made significant improvement but still unusable I don't think the
IO
method would be any efficient but if there's any way to send the whole
BufferedImage
object or deserilizing it without using IO would be take less time
a

Aleksei Tirman [JB]

08/18/2022, 6:51 AM
Could you please clarify why the solution 4 is unusable?
a

Ananiya

08/19/2022, 12:51 PM
Thanks @Aleksei Tirman [JB] for the response It's because one is it take like minutes to process the The idea is to send continuous frame from the webcam -> ktor server -> ktor client first 3 frames even if we don't take such phenomenon in an account there's one major problems and it was after those frames are loaded it would smooth out but also the loaded frame are a minute apart than the frame that was sent by the server
a

Aleksei Tirman [JB]

08/19/2022, 1:55 PM
Is it possible to read raw data (without
BufferedImage
) from the webcam to send it over a Websocket connection?
a

Ananiya

08/19/2022, 1:58 PM
There was variable which return
ByteBuffer
but was empty
8 Views