uvic-aero / onboard-computer

0 stars 1 forks source link

Video Server : New Function - Broadcast Frame #27

Closed dragonprevost closed 4 years ago

dragonprevost commented 4 years ago

Create a function in the video server application that takes a numpy array from another application, encodes it, then broadcasts it the the clients connected to the application. This may require preprocessing the frame to make it smaller in size prior to sending it over the socket. It may also require breaking the frame into smaller segments and sending those segments over the socket.

Might look a little something like this, except the client address will have to be stored somewhere in the class in order for this to work properly

def broadcast_frame(self, frame):
    buffer = cv2.imencode('.jpg', frame)[1].tostring()
    socket.sendto(buffer, client_address)