EasyManuals Logo

Freenove 4WD Smart Car Board for Raspberry Pi User Manual

Default Icon
132 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #102 background imageLoading...
Page #102 background image
Need support? support.freenove.com
98
Chapter 7 Smart video car
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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)

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove 4WD Smart Car Board for Raspberry Pi and is the answer not in the manual?

Freenove 4WD Smart Car Board for Raspberry Pi Specifications

General IconGeneral
BrandFreenove
Model4WD Smart Car Board for Raspberry Pi
CategoryMicrocontrollers
LanguageEnglish