Hey everyone. I’m sorry my first post is just me asking for help, but hopefully I can become good enough one day to help others.
I’m working on a client/server setup to practice golang where I use gocv to grab an image from my webcam along with some extra metadata and send it to a remote server for processing. Both processes are written in go. What would be the best way to transmit the mat to the server process?
I have already tried to use gob like so:
----Server-------
func handleConnection(conn net.Conn) {
dec := gob.NewDecoder(conn)
p := gocv.NewMat()
dec.Decode(&p)
gocv.IMWrite("test.png", p)
conn.Close()
}
----Client----------------------
encoder := gob.NewEncoder(conn)
encoder.Encode(img) //img is the mat
This didn’t work. I’ve also tried reading the mat pixel by pixel and sending it all encoded as a string, but that just feels wrong. How would I send/receive this simply using the “net” package?