def getImage(self, event):
     w = SocketPacket()
     w.add_int(VP_CAM_IMAGE)
     w.add_int(self.client_id)
     w.add_int(self.cam_id)
     w.encode_header()
     self.write_packet(w)
 def getImage(self, event):
     w = SocketPacket()
     w.add_int(VP_CAM_IMAGE)
     w.add_int(self.client_id)
     w.add_int(self.cam_id)
     w.encode_header()
     self.write_packet(w)
 def getImage(self, event):
     button = event.GetEventObject()
     name_words_list = (button.GetName()).split()
     camera_number = int(name_words_list[4])
     w = SocketPacket()
     w.add_int(VP_CAM_IMAGE)
     index_camera_numbers = self.camera_numbers.index(str(camera_number))
     w.add_int(self.client_ids[index_camera_numbers])
     w.add_int(camera_number)
     w.encode_header()
     self.write_packet(w, index_camera_numbers)
Example #4
0
 def default(self, event):
     w = SocketPacket()
     w.add_int(VP_CAM_DEFAULT)
     w.add_int(self.client_id)
     w.add_int(self.cam_id)
     w.encode_header()
     self.write_packet(w)
    def getImage(self, event):
	button = event.GetEventObject()
	name_words_list = (button.GetName()).split()
	camera_number = int(name_words_list[4])
	w = SocketPacket()
        w.add_int(VP_CAM_IMAGE)
        index_camera_numbers = self.camera_numbers.index(str(camera_number))
        w.add_int(self.client_ids[index_camera_numbers])
        w.add_int(camera_number)
        w.encode_header()
        self.write_packet(w, index_camera_numbers)
 def default(self, event):
     w = SocketPacket()
     w.add_int(VP_CAM_DEFAULT)
     w.add_int(self.client_id)
     w.add_int(self.cam_id)
     w.encode_header()
     self.write_packet(w)
Example #7
0
    def __init__(self, parent, ip, port, vv_id):
        self.parent = parent
        self.ip = ip
        self.port = port
        self.vv_id = vv_id
        self.conn_id = None
        self.cameras = []

        try:
            self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.socket.connect((ip, port))
            self.socket.setblocking(0)
        except Exception as e:
            logging.error("Error connecting to server!")
            logging.error(e)
            sys.exit()

        self.read_buffer = ''
        self.write_buffer = ''
        self.read_state = 0
        self.packet = SocketPacket()
    def zoomOut(self, event):
	button = event.GetEventObject()
	name_words_list = (button.GetName()).split()
	camera_number = int(name_words_list[2])
	indexTextCtrl = int(name_words_list[4])
	w = SocketPacket()
	w.add_int(VP_CAM_ZOOM)
	index_camera_numbers = self.camera_numbers.index(str(camera_number))
	w.add_int(self.client_ids[index_camera_numbers])
	w.add_int(camera_number)
	w.add_float(10.0)
	w.add_float(DEFAULT_ZOOM_SPEED)
	w.encode_header()
	self.write_packet(w, index_camera_numbers)
    def zoom(self, event):
        id = event.GetEventObject().GetId()

        if id == 104:
            direction = -1

        else:
            direction = 1

        angle = direction * 10
        w = SocketPacket()
        w.add_int(VP_CAM_ZOOM)
        w.add_int(self.client_id)
        w.add_int(self.cam_id)
        w.add_float(angle)
        w.encode_header()
        self.write_packet(w)
 def setResolution(self, event):
     try:
         width = int(self.width.GetValue())
         height = int(self.height.GetValue())
         self.width.SetValue("")
         self.height.SetValue("")
     except Exception as e:
         logging.error("Resolution is not valid!")
     else:
         w = SocketPacket()
         w.add_int(VP_CAM_RESOLUTION)
         w.add_int(self.client_id)
         w.add_int(self.cam_id)
         w.add_int(width)
         w.add_int(height)
         w.encode_header()
         self.write_packet(w)
    def new_data_callback(self, packet, index):
        message_type = packet.get_int()
        if message_type == VV_ACK_OK:
	    server_ip = packet.get_string()
	    server_port = packet.get_int()
	    self.client_ids[index] = packet.get_int()
	    logging.info("Connection Established.")

	    w = SocketPacket()
	    w.add_int(VP_SESSION)
	    w.add_int(self.client_ids[index])
	    w.add_char(SESSION_TYPE)
	    w.add_char(self.pipeline[index])
	    w.add_int(int(self.camera_numbers[index]))
	    w.encode_header()
	    self.write_packet(w, index)

        elif message_type == VV_VP_ACK_OK:
	    packet.get_string()
	    packet.get_int()
	    cam_id = packet.get_int()

        elif message_type == VV_REQ_VIDEO_ANALYSIS:
            logging.debug("VV_REQ_VIDEO_ANALYSIS")
            ip = packet.get_string()
            port = packet.get_int()
            camera_id = packet.get_int()
            
	elif message_type == VV_IMG:
            logging.debug("NEW IMAGE")
            server_ip = packet.get_string()
            server_port = packet.get_int()
            cam_id = packet.get_int()
            width = packet.get_int()
            height = packet.get_int()
            depth = packet.get_int()
            color_code = packet.get_char()
            jpeg =  packet.get_bool()
            time = packet.get_double()
            image = packet.get_string()
            cv_im = self.createImage(image, width, height, depth, color_code, jpeg)
            index_camera_numbers = self.camera_numbers.index(str(cam_id))
            cv.SaveImage("cam%s_%s.jpg" % (cam_id, self.counts[index_camera_numbers]), cv_im)
            self.counts[index_camera_numbers] += 1
	    cv.ShowImage("Image", cv_im)
            cv.WaitKey()
 def zoom(self, event):
     button = event.GetEventObject()
     name_words_list = (button.GetName()).split()
     camera_number = int(name_words_list[2])
     indexTextCtrl = int(name_words_list[4])
     angle_string = (self.zoom_angle_values[indexTextCtrl]).GetValue()
     speed_string = (self.zoom_speed_values[indexTextCtrl]).GetValue()
     angle = float(angle_string)
     speed = float(speed_string)
     w = SocketPacket()
     w.add_int(VP_CAM_CUSTOM_ZOOM)
     index_camera_numbers = self.camera_numbers.index(str(camera_number))
     w.add_int(self.client_ids[index_camera_numbers])
     w.add_int(camera_number)
     w.add_float(angle)
     w.add_float(speed)
     w.encode_header()
     self.write_packet(w, index_camera_numbers)
    def new_data_callback(self, packet, index):
        message_type = packet.get_int()
        if message_type == VV_ACK_OK:
            server_ip = packet.get_string()
            server_port = packet.get_int()
            self.client_ids[index] = packet.get_int()
            logging.info("Connection Established.")

            w = SocketPacket()
            w.add_int(VP_SESSION)
            w.add_int(self.client_ids[index])
            w.add_char(SESSION_TYPE)
            w.add_char(self.pipeline[index])
            w.add_int(int(self.camera_numbers[index]))
            w.encode_header()
            self.write_packet(w, index)

        elif message_type == VV_VP_ACK_OK:
            packet.get_string()
            packet.get_int()
            cam_id = packet.get_int()

        elif message_type == VV_REQ_VIDEO_ANALYSIS:
            logging.debug("VV_REQ_VIDEO_ANALYSIS")
            ip = packet.get_string()
            port = packet.get_int()
            camera_id = packet.get_int()

        elif message_type == VV_IMG:
            logging.debug("NEW IMAGE")
            server_ip = packet.get_string()
            server_port = packet.get_int()
            cam_id = packet.get_int()
            width = packet.get_int()
            height = packet.get_int()
            depth = packet.get_int()
            color_code = packet.get_char()
            jpeg = packet.get_bool()
            time = packet.get_double()
            image = packet.get_string()
            cv_im = self.createImage(image, width, height, depth, color_code,
                                     jpeg)
            index_camera_numbers = self.camera_numbers.index(str(cam_id))
            cv.SaveImage(
                "cam%s_%s.jpg" % (cam_id, self.counts[index_camera_numbers]),
                cv_im)
            self.counts[index_camera_numbers] += 1
            cv.ShowImage("Image", cv_im)
            cv.WaitKey()
Example #14
0
    def customZoom(self, event):
        w = SocketPacket()
	w.add_int(VP_CAM_ZOOM)
        w.add_int(self.client_id)
        w.add_int(self.cam_id)
        w.add_float(event.GetDegrees())
	w.add_float(event.GetSpeed())
        w.encode_header()
        self.write_packet(w)
Example #15
0
    def zoom(self, event):
        id = event.GetEventObject().GetId()

        if id == 104:
            direction = -1

        else:
            direction = 1

        angle = direction * 10
        w = SocketPacket()
        w.add_int(VP_CAM_ZOOM)
        w.add_int(self.client_id)
        w.add_int(self.cam_id)
        w.add_float(angle)
        w.add_float(DEFAULT_ZOOM_SPEED)
        w.encode_header()
        self.write_packet(w)
    def tilt(self, event):
        id = event.GetEventObject().GetId()

        if id == 102:
            direction = 1

        else:
            direction = -1

        angle = direction * 10
        w = SocketPacket()
        w.add_int(VP_CAM_TILT)
        w.add_int(self.client_id)
        w.add_int(self.cam_id)
        w.add_float(angle)
        w.add_float(DEFAULT_TILT_SPEED)
        w.encode_header()
        self.write_packet(w)
Example #17
0
    def pan(self, direction, degrees = 10, speed = DEFAULT_PAN_SPEED):
        angle = direction * degrees
        w = SocketPacket()
        w.add_int(VP_CAM_PAN)
        w.add_int(self.client_id)
        w.add_int(self.cam_id)
        w.add_float(angle)
	w.add_float(speed)
        w.encode_header()
        self.write_packet(w)
Example #18
0
 def setResolution(self, event):
     try:
         width = int(self.width.GetValue())
         height = int(self.height.GetValue())
         self.width.SetValue("")
         self.height.SetValue("")
     except Exception as e:
         logging.error("Resolution is not valid!")
     else:
         w = SocketPacket()
         w.add_int(VP_CAM_RESOLUTION)
         w.add_int(self.client_id)
         w.add_int(self.cam_id)
         w.add_int(width)
         w.add_int(height)
         w.encode_header()
         self.write_packet(w)
    def new_data_callback(self, packet):
        message_type = packet.get_int()
        if message_type == VV_ACK_OK:
          server_ip = packet.get_string()
          server_port = packet.get_int()
          self.client_id = packet.get_int()
          logging.info("Connection Established.")

          w = SocketPacket()
          w.add_int(VP_SESSION)
          w.add_int(self.client_id)
          w.add_char(SESSION_TYPE)
          w.add_char(self.pipeline)
          w.encode_header()
          self.write_packet(w)


        elif message_type == VV_VP_ACK_OK:
          packet.get_string()
          packet.get_int()
          self.cam_id = packet.get_int()
          self.connected = True


        elif message_type == VV_REQ_VIDEO_ANALYSIS:
            logging.debug("VV_REQ_VIDEO_ANALYSIS")
            ip = packet.get_string()
            port = packet.get_int()
            self.camera_id = packet.get_int()
            self.SetTitle("Camera %s Controller" % self.camera_id)


        elif message_type == VV_IMG:
            logging.debug("NEW IMAGE")
            server_ip = packet.get_string()
            server_port = packet.get_int()
            cam_id = packet.get_int()
            width = packet.get_int()
            height = packet.get_int()
            depth = packet.get_int()
            color_code = packet.get_char()
            jpeg =  packet.get_bool()
            time = packet.get_double()
            image = packet.get_string()

            cv_im = self.createImage(image, width, height, depth, color_code, jpeg)

            self.camera_id = cam_id
            cv.ShowImage("Image", cv_im)
            if self.save_images:
                cv.SaveImage("cam%s_%s.jpg" % (cam_id, self.count), cv_im)
                self.count+=1
            cv.WaitKey()
 def zoomOut(self, event):
     button = event.GetEventObject()
     name_words_list = (button.GetName()).split()
     camera_number = int(name_words_list[2])
     indexTextCtrl = int(name_words_list[4])
     w = SocketPacket()
     w.add_int(VP_CAM_ZOOM)
     index_camera_numbers = self.camera_numbers.index(str(camera_number))
     w.add_int(self.client_ids[index_camera_numbers])
     w.add_int(camera_number)
     w.add_float(10.0)
     w.add_float(DEFAULT_ZOOM_SPEED)
     w.encode_header()
     self.write_packet(w, index_camera_numbers)
    def zoom(self, event):
	button = event.GetEventObject()
	name_words_list = (button.GetName()).split()
	camera_number = int(name_words_list[2])
	indexTextCtrl = int(name_words_list[4])
	angle_string = (self.zoom_angle_values[indexTextCtrl]).GetValue()
	speed_string = (self.zoom_speed_values[indexTextCtrl]).GetValue()
	angle = float(angle_string)
	speed = float(speed_string)
	w = SocketPacket()
	w.add_int(VP_CAM_CUSTOM_ZOOM)
	index_camera_numbers = self.camera_numbers.index(str(camera_number))
	w.add_int(self.client_ids[index_camera_numbers])
	w.add_int(camera_number)
	w.add_float(angle)
	w.add_float(speed)
	w.encode_header()
	self.write_packet(w, index_camera_numbers)
Example #22
0
    def new_data_callback(self, packet):
        message_type = packet.get_int()
        if message_type == VV_ACK_OK:
          server_ip = packet.get_string()
          server_port = packet.get_int()
          self.client_id = packet.get_int()
          logging.info("Connection Established.")

          w = SocketPacket()
          w.add_int(VP_SESSION)
          w.add_int(self.client_id)
          w.add_char(SESSION_TYPE)
          w.add_char(self.pipeline)
          w.add_int(self.req_cam_id)
          w.encode_header()
          self.write_packet(w)


        elif message_type == VV_VP_ACK_OK:
          packet.get_string()
          packet.get_int()
          self.cam_id = packet.get_int()
          self.connected = True


        elif message_type == VV_REQ_VIDEO_ANALYSIS:
            logging.debug("VV_REQ_VIDEO_ANALYSIS")
            ip = packet.get_string()
            port = packet.get_int()
            self.camera_id = packet.get_int()
            self.SetTitle("Camera %s Controller" % self.camera_id)


        elif message_type == VV_IMG:
            logging.debug("NEW IMAGE")
            server_ip = packet.get_string()
            server_port = packet.get_int()
            cam_id = packet.get_int()
            width = packet.get_int()
            height = packet.get_int()
            depth = packet.get_int()
            color_code = packet.get_char()
            jpeg =  packet.get_bool()
            time = packet.get_double()
            image = packet.get_string()

            cv_im = self.createImage(image, width, height, depth, color_code, jpeg)
            self.camera_id = cam_id
            if self.save_images:
                cv.SaveImage("cam%s_%s.jpg" % (cam_id, self.count), cv_im)
                self.count+=1
            else:
		cv.ShowImage("Image", cv_im)
            cv.WaitKey()
Example #23
0
    def __init__(self, parent, id, title, ip_address, port, pipeline, req_cam_id,
                 save_images=False):
        wx.Frame.__init__(self, parent, id, title, size=(230, 360))

        self.req_cam_id = req_cam_id;
        panel = wx.Panel(self, -1)
        wx.Button(panel, 100, "Pan Left", (10,0), (100,30))
        wx.Button(panel, 101, "Pan Right", (120,0), (100,30))
        wx.Button(panel, 102, "Tilt Up", (10,40), (100,30))
        wx.Button(panel, 103, "Tilt Down", (120,40), (100,30))
        wx.Button(panel, 104, "Zoom In", (10,80), (100,30))
        wx.Button(panel, 105, "Zoom Out", (120,80), (100,30))
        wx.Button(panel, 106, "Default", (65,120), (100,30))
        wx.Button(panel, 107, "Get Image", (65, 160), (100, 30))

        wx.StaticBox(panel, -1, 'Image Resolution', (10, 200), size=(210, 150))
        wx.StaticText(panel, -1, 'Width:', (25, 235))
        self.width = wx.TextCtrl(panel, 108, "", (85, 225), (120, 30))
        wx.StaticText(panel, -1, 'Height:', (25, 270))
        self.height = wx.TextCtrl(panel, 109, "", (85, 260), (120, 30))
        wx.Button(panel, 110, "Set Resolution", (85, 300), (120, 30))

        try:
            logging.debug("Connecting to server with IP: %s and PORT: %s" 
                          %(ip_address, port))
            self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.client_socket.connect((ip_address, port))
            #self.client_socket.settimeout(3)
            self.client_socket.setblocking(0)

        except Exception as e:
            print "Error connecting to server!"
            sys.exit(0)

        self.read_buffer = ''
        self.write_buffer = ''
        self.read_state = 0
        self.packet = SocketPacket()
        self.connected = False
        self.x1 = 100
        self.x2 = 140
        self.count = 0
        self.pipeline = pipeline

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.step, self.timer)
        self.timer.Start(0.01 * 1000.0, oneShot=False)

        self.Bind(wx.EVT_BUTTON, self.panLeft, id=100)
        self.Bind(wx.EVT_BUTTON, self.panRight, id=101)
        self.Bind(wx.EVT_BUTTON, self.tilt, id=102)
        self.Bind(wx.EVT_BUTTON, self.tilt, id=103)
        self.Bind(wx.EVT_BUTTON, self.zoom, id=104)
        self.Bind(wx.EVT_BUTTON, self.zoom, id=105)
        self.Bind(wx.EVT_BUTTON, self.default, id=106)
        self.Bind(wx.EVT_BUTTON, self.getImage, id=107)
        self.Bind(wx.EVT_BUTTON, self.setResolution, id=110)

        self.save_images = save_images

	EVT_CUSTOM_PAN = wx.PyEventBinder(panEVT_CUSTOM, 1)
	EVT_CUSTOM_TILT = wx.PyEventBinder(tiltEVT_CUSTOM, 1)
	EVT_CUSTOM_ZOOM = wx.PyEventBinder(zoomEVT_CUSTOM, 1)
	EVT_CUSTOM_GET_IMAGE = wx.PyEventBinder(getImageEVT_CUSTOM, 1)
	
	self.Bind(EVT_CUSTOM_PAN, self.customPan)
	self.Bind(EVT_CUSTOM_TILT, self.customTilt)
	self.Bind(EVT_CUSTOM_ZOOM, self.customZoom)
	self.Bind(EVT_CUSTOM_GET_IMAGE, self.getImage)
    def __init__(self, parent, id, title, ip_address, port):
        wx.Frame.__init__(self, parent, id, title, size=(1350, 800))
        self.panel = wx.Panel(self, -1)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.step, self.timer)
        self.timer.Start(10, oneShot=False)

        self.camera_list = [3, 2, 1, 4, 5, 6]
        self.top_left_corners = {
            0: (0, 0),
            1: (450, 0),
            2: (900, 0),
            3: (0, 400),
            4: (450, 400),
            5: (900, 400)
        }
        self.camera_numbers = ['1', '2', '3', '4', '5', '6']
        self.pipeline = [
            STATIC_PIPELINE, STATIC_PIPELINE, ACTIVE_PIPELINE, ACTIVE_PIPELINE,
            ACTIVE_PIPELINE, ACTIVE_PIPELINE
        ]

        self.client_sockets = [None] * len(self.camera_numbers)
        self.read_buffers = [None] * len(self.camera_numbers)
        self.write_buffers = [None] * len(self.camera_numbers)
        self.read_states = [None] * len(self.camera_numbers)
        self.packets = [None] * len(self.camera_numbers)
        self.read_body_lengths = [None] * len(self.camera_numbers)
        self.client_ids = [None] * len(self.camera_numbers)
        self.counts = [None] * len(self.camera_numbers)

        try:
            for i in range(0, len(self.camera_numbers)):
                logging.debug("Connecting to server with IP: %s and PORT: %s" %
                              (ip_address, port))
                self.read_buffers[i] = ''
                self.write_buffers[i] = ''
                self.read_states[i] = 0
                self.packets[i] = SocketPacket()
                self.client_sockets[i] = socket.socket(socket.AF_INET,
                                                       socket.SOCK_STREAM)
                self.client_sockets[i].connect((ip_address, port))
                self.client_sockets[i].setblocking(0)
                self.counts[i] = 0

        except Exception as e:
            print "Error connecting to server!"
            print e
            sys.exit(0)

        self.pan_angle_values = [None] * 6
        self.pan_speed_values = [None] * 6
        self.tilt_angle_values = [None] * 6
        self.tilt_speed_values = [None] * 6
        self.zoom_angle_values = [None] * 6
        self.zoom_speed_values = [None] * 6
        self.pan_buttons = [None] * 6
        self.tilt_buttons = [None] * 6
        self.zoom_buttons = [None] * 6
        self.left_buttons = [None] * 6
        self.right_buttons = [None] * 6
        self.up_buttons = [None] * 6
        self.down_buttons = [None] * 6
        self.plus_buttons = [None] * 6
        self.minus_buttons = [None] * 6
        self.image_buttons = [None] * 6
        self.angle_texts = [None] * 18
        self.speed_texts = [None] * 18

        for i in range(0, 6):
            self.pan_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Pan',
                name='Pan Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 10,
                     (self.top_left_corners[i])[1] + 22),
                size=(50, 25))
            self.tilt_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Tilt',
                name='Tilt Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 10,
                     (self.top_left_corners[i])[1] + 57),
                size=(50, 25))
            self.zoom_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Zoom',
                name='Zoom Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 10,
                     (self.top_left_corners[i])[1] + 92),
                size=(50, 25))
            self.image_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Get Image',
                name='Get Image from Camera ' + str(self.camera_list[i]) +
                ' Index ' + str(i),
                pos=((self.top_left_corners[i])[0] + 10,
                     (self.top_left_corners[i])[1] + 127))
            self.left_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Left',
                name='Left Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 120,
                     (self.top_left_corners[i])[1] + 200),
                size=(50, 25))
            self.right_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Right',
                name='Right Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 180,
                     (self.top_left_corners[i])[1] + 200),
                size=(50, 25))
            self.up_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Up',
                name='Up Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 150,
                     (self.top_left_corners[i])[1] + 170),
                size=(50, 25))
            self.down_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='Down',
                name='Down Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 150,
                     (self.top_left_corners[i])[1] + 230),
                size=(50, 25))
            self.plus_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='+',
                name='Down Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 140,
                     (self.top_left_corners[i])[1] + 270),
                size=(25, 25))
            self.minus_buttons[i] = wx.Button(
                self.panel,
                id=-1,
                label='-',
                name='Down Camera ' + str(self.camera_list[i]) + ' Index ' +
                str(i),
                pos=((self.top_left_corners[i])[0] + 185,
                     (self.top_left_corners[i])[1] + 270),
                size=(25, 25))
            (self.pan_buttons[i]).Bind(wx.EVT_BUTTON, self.pan)
            (self.tilt_buttons[i]).Bind(wx.EVT_BUTTON, self.tilt)
            (self.zoom_buttons[i]).Bind(wx.EVT_BUTTON, self.zoom)
            (self.image_buttons[i]).Bind(wx.EVT_BUTTON, self.getImage)
            (self.left_buttons[i]).Bind(wx.EVT_BUTTON, self.panLeft)
            (self.right_buttons[i]).Bind(wx.EVT_BUTTON, self.panRight)
            (self.up_buttons[i]).Bind(wx.EVT_BUTTON, self.tiltUp)
            (self.down_buttons[i]).Bind(wx.EVT_BUTTON, self.tiltDown)
            (self.plus_buttons[i]).Bind(wx.EVT_BUTTON, self.zoomIn)
            (self.minus_buttons[i]).Bind(wx.EVT_BUTTON, self.zoomOut)
            for j in range(3 * i, 3 * i + 3):
                self.angle_texts[j] = wx.StaticText(
                    self.panel, -1, "Angle",
                    ((self.top_left_corners[i])[0] + 80,
                     (self.top_left_corners[i])[1] + 25 + 35 * (j - 3 * i)))
                self.speed_texts[j] = wx.StaticText(
                    self.panel, -1, "Speed",
                    ((self.top_left_corners[i])[0] +
                     (self.angle_texts[j].GetSize())[0] + 210,
                     (self.top_left_corners[i])[1] + 25 + 35 * (j - 3 * i)))
            self.pan_angle_values[i] = wx.TextCtrl(
                self.panel,
                pos=((self.top_left_corners[i])[0] + 80 +
                     (self.angle_texts[i].GetSize())[0] + 10,
                     (self.top_left_corners[i])[1] + 22),
                size=(100, 25))
            self.tilt_angle_values[i] = wx.TextCtrl(
                self.panel,
                pos=((self.top_left_corners[i])[0] + 80 +
                     (self.angle_texts[i].GetSize())[0] + 10,
                     (self.top_left_corners[i])[1] + 57),
                size=(100, 25))
            self.zoom_angle_values[i] = wx.TextCtrl(
                self.panel,
                pos=((self.top_left_corners[i])[0] + 80 +
                     (self.angle_texts[i].GetSize())[0] + 10,
                     (self.top_left_corners[i])[1] + 92),
                size=(100, 25))
            self.pan_speed_values[i] = wx.TextCtrl(
                self.panel,
                pos=((self.top_left_corners[i])[0] +
                     (self.angle_texts[0].GetSize())[0] +
                     (self.speed_texts[0].GetSize())[0] + 220,
                     (self.top_left_corners[i])[1] + 22),
                size=(100, 25))
            self.tilt_speed_values[i] = wx.TextCtrl(
                self.panel,
                pos=((self.top_left_corners[i])[0] +
                     (self.angle_texts[0].GetSize())[0] +
                     (self.speed_texts[0].GetSize())[0] + 220,
                     (self.top_left_corners[i])[1] + 57),
                size=(100, 25))
            self.zoom_speed_values[i] = wx.TextCtrl(
                self.panel,
                pos=((self.top_left_corners[i])[0] +
                     (self.angle_texts[0].GetSize())[0] +
                     (self.speed_texts[0].GetSize())[0] + 220,
                     (self.top_left_corners[i])[1] + 92),
                size=(100, 25))
    def tilt(self, event):
        id = event.GetEventObject().GetId()

        if id == 102:
            direction = 1

        else:
            direction = -1

        angle = direction * 10
        w = SocketPacket()
        w.add_int(VP_CAM_TILT)
        w.add_int(self.client_id)
        w.add_int(self.cam_id)
        w.add_float(angle)
        w.encode_header()
        self.write_packet(w)