Client 
The client connects to the server through TCP, which receives the video stream from the server, and other 
commands. And it also sends commands to the server to control the car.  
Clients can run on different systems, such as windows, Linux, and so on. However, you need to install related 
software and libraries. 
 
The related program is mainly in the Video.py file under the Client folder. 
Part of client code is as below: 
class VideoStreaming: 
 def __init__(self): 
 self.face_cascade = cv2.CascadeClassifier(r'haarcascade_frontalface_default.xml') 
 self.video_Flag=True 
 self.connect_Flag=False 
 self.face_x=0 
 self.face_y=0 
 def StartTcpClient(self,IP): 
 self.client_socket1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
 self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
 def StopTcpcClient(self): 
 try: 
  self.client_socket.shutdown(2) 
  self.client_socket1.shutdown(2) 
  self.client_socket.close() 
  self.client_socket1.close() 
 except: 
  pass 
 
 def IsValidImage4Bytes(self,buf):  
        bValid = True 
 if buf[6:10] in (b'JFIF', b'Exif'):   
  if not buf.rstrip(b'\0\r\n').endswith(b'\xff\xd9'): 
       bValid = False 
 else:  
  try:  
       Image.open(io.BytesIO(buf)).verify()  
  except:   
       bValid = False 
 return bValid 
 
  def face_detect(self,img): 
 if sys.platform.startswith('win'): 
   gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)