User Manual

Table Of Contents
94
This chapter does not introduce the OpenCV part first, only introduces how to see the real-time picture
of the Raspberry Pi camera on other devices.
First download flask-video-streaming this project in the Raspberry Pi. You can download it from Clone
on GitHub or download it on your computer and then pass it to the Raspberry Pi. The download command
using the Raspberry Pi console is as follows:
sudo git clone https://github.com/miguelgrinberg/flask-video-streaming.git
After downloading or transmitting flask-video-streaming in the Raspberry Pi, run the app.py in
flask-video-streaming:
cd flask-video-streaming
sudo python3 app.py
Not to use sudo python3 flask-video-streaming / app.py to run, there will be an error that * .jpeg is not
found.
Open the browser on the device on the same local area network as the Raspberry Pi (we use Google
Chrome to test), and enter the IP address of the Raspberry Pi plus the video streaming port number: 5000 in
the address bar, as shown in the following example:
192.168.3.157:5000
Now you can see the page created by the Raspberry Pi on the browser of your computer or mobile
phone. Note that the default screen is not from the screen of the Raspberry Pi camera, but three digital pictures
cyclically playing 1, 2, 3
If your page can log in and is playing a picture of 1 \ 2 \ 3 numbers in a loop, it means that the
flask-related programs are running normally. Next, you can make some modifications to app.py so that it can
15 Real-Time Video Transmission
Real-time video and OpenCV function are the advantages of the Raspberry Pi robot. This chapter
introduces the method of real-time video. In fact, there are many ways to transfer the images collected by the
Raspberry Pi camera to other devices through the network The robot uses the open source project [
ask-video-streaming] from Github the MIT open source agreement, you can click the link to view the source
code of the project.
The reason for the selection is flask-video-streaming. This solution is the most convenient and the most
efficient of the many solutions we have tried. The part related to OpenCV also has a good interface to rewrite it
as multi-threaded processing.
Since this project requires the use of Flask and related dependent libraries, our robot software
installation script contains the content of installing these dependent libraries. If your Raspberry Pi has not run
the robot software installation script, you need to use the following command to install .
sudo pip3 install flask
sudo pip3 install flask_cors