CameraTCP

class mobrob_behcon.connectors.camera.CameraTCP(ip_address, port)[source]

The class CameraTCP

Represents a connector to the Camera on the robot. Provides a function to get a image from camera.

Attributes

BUFFER_SIZE

MESSAGE

Methods

__init__(ip_address, port)

constructor

get_frame()

Get new frame from camera

recvall(sock, n)

Helper function to recv n bytes or return None if EOF is hit

stringToRGB(base64_string)

Convert base64 encoded image to OpenCV image

Details

__init__(ip_address, port)[source]

constructor

Parameters
  • ip_address (string) – ip address of camera server

  • port (int) – port of camera server

get_frame()[source]

Get new frame from camera

Returns

returns current frame from camera

static recvall(sock, n)[source]

Helper function to recv n bytes or return None if EOF is hit

Parameters
  • sock (TCPServer) – socket

  • n (int) – number of bytes

Returns

returns data as bytearray

static stringToRGB(base64_string)[source]

Convert base64 encoded image to OpenCV image

Parameters

base64_string (string) – image encoded as base64 string

Returns

returns image as OpenCV image