Tutorial

Table Of Contents
96
for frame in frames_iterator:
BaseCamera.frame = frame
BaseCamera.event.set() # send signal to clients
time.sleep(0)
# if there hasn't been any clients asking for frames in
# the last 10 seconds then stop the thread
if time.time() - BaseCamera.last_access > 10:
frames_iterator.close()
print('Stopping camera thread due to inactivity.')
break
BaseCamera.thread = None
When you use the follow-up tutorial to develop a certain OpenCV related function, you only need to put
the corresponding camera_opencv.py in the same folder as this app.py and base_camera.py, and then run it in
the Raspberry Pi console just app.py.
Open the browser with a device on the same local area network as the Raspberry Pi, enter the IP
address of the Raspberry Pi in the address bar, and access port 5000. The address is shown in the following
example:
192.168.3.161:5000